‹ Return to How tos

Pushing and managing container images on your Amazon Lightsail container services

Last updated: November 12, 2020

When you create a deployment in your Amazon Lightsail container service, you must specify a source container image for each container entry. You can use images from a public registry, such as Docker Hub, or you can use images that you create on your local machine. In this guide, we show you how to push container images from your local machine to your Lightsail container service. For more information about creating container images, see Creating container images for your Amazon Lightsail container services.

Contents:

Prerequisites

Complete the following prerequisites before you get started with pushing your container images to your container service:

Push container images from your local machine to your container service

Complete the following procedure to push your container images to your container service.

  1. Open a command prompt or terminal window.

  2. In the command prompt or terminal window, enter the following command to view the Docker images that are currently on your local machine.

    docker images
  3. In the result, locate the name (repository name) and tag of the container image that you want to push to your container service. Make a note of it because you will need it in the next step.

    Docker container images on a local machine
  4. Enter the following command to push the container image on your local machine to your container service.

    aws lightsail push-container-image --region <Region> --service-name <ContainerServiceName> --label <ContainerImageLabel> --image <LocalContainerImageName>:<ImageTag>

    In the command, replace:

    • <Region> with the AWS Region in which your container service was created.

    • <ContainerServiceName> with the name of your container service.

    • <ContainerImageLabel> with the label that you want to give your container image when it's stored on your container service. Specify a descriptive label that you can use to track the different versions of your registered container images.

      The label will be part of the container image name generated by your container service. For example, if your container service name is container-service-1, the container image label is mystaticsite, and this is the first version of the container image you're pushing, then the image name generated by your container service will be :container-service-1.mystaticsite.1.

    • <LocalContainerImageName> with the name of the container image that you want to push to your container service. You obtained the container image name in the previous step of this procedure.

    • <ImageTag> with the tag of the container image that you want to push to your container service. You obtained the container image tag in the previous step of this procedure.

    Example:

    aws lightsail push-container-image --region us-west-2 --service-name myservice --label mystaticwebsite --image mystaticwebsite:v2

    You should see a result similar to the following example, which confirms that your container image was pushed to your container service.

    Docker container image pushed to a Lightsail container service

    Refer to the following View container images stored on your container service section of this guide to view your pushed container image in your container service on the Lightsail console.

View container images stored on your container service

Complete the following procedure to view container images that were pushed, and are being stored, on your container service.

  1. Sign in to the Lightsail console.

  2. On the Lightsail home page, choose the Containers tab.

  3. Choose the name of the container service for which you want to view the stored container images.

  4. On the container service management page, choose the Images tab.

    Note

    The Images tab is not displayed if you have not pushed images to your container service. To display the images tab for your container service you must first push container images to your service.

    The Images page lists the container images that were pushed to your container service, and are currently being stored on your service. Container images that are being used in a current deployment cannot be deleted and are listed with a grayed-out delete icon.

    The stored images page of the Lightsail console

    You can create deployments using container images stored on your service. For more information, see Creating and managing deployments for your Amazon Lightsail container services.

Delete container images stored on your container service

Complete the following procedure to delete container images that were pushed, and are being stored, on your container service.

  1. Sign in to the Lightsail console.

  2. On the Lightsail home page, choose the Containers tab.

  3. Choose the name of the container service for which you want to view the current deployment.

  4. On the container service management page, choose the Images tab.

    Note

    The Images tab is not displayed if you have not pushed images to your container service. To display the images tab for your container service you must first push container images to your service.

  5. Find the container image you want to delete, and choose the delete (trash bin) icon.

    Note

    Container images that are being used in a current deployment cannot be deleted and their delete icons are grayed-out.

  6. In the confirmation prompt that appears, choose Yes, delete to confirm that you want to permanently delete the stored image.

    Your stored container image is immediately deleted from your container service.

Additional information about container services

These are the general steps to manage your Lightsail container service after it's up and running:

  1. Get familiar with all of the elements of Lightsail container services. For more information, see Container services in Amazon Lightsail.

  2. Create your container service in your Lightsail account. For more information, see Creating Amazon Lightsail container services.

  3. If you plan to use container images from a public registry, find container images that you want to use from a public registry like Docker Hub. For more information, see Docker Hub Quickstart in the Docker documentation.

  4. If you plan to push container images from your local machine to your service, install software on your local machine that you need to create your own container images and push them to your Lightsail container service. For more information, see the following guides:

  5. Create a deployment in your container service that configures and launches your containers. For more information, see Creating and managing deployments for your Amazon Lightsail container services.

  6. View previous deployments for your container service. You can create a new deployment using a previous deployment version. For more information, see Viewing and managing deployment versions of your Amazon Lightsail container services.

  7. View the logs of containers on your container service. For more information, see Viewing the container logs of your Amazon Lightsail container services.

  8. Create an SSL/TLS certificate for the domains that you want to use with your containers. For more information, see Creating SSL/TLS certificates for your Amazon Lightsail container services.

  9. Validate the SSL/TLS certificate by adding records to the DNS of your domains. For more information, see Validating SSL/TLS certificates for your Amazon Lightsail container services.

  10. Enable custom domains by attaching a valid SSL/TLS certificate to your container service. For more information, see Enabling and managing custom domains for your Amazon Lightsail container services.

  11. Monitor the utilization metrics of your container service. For more information, see Viewing container service metrics in Amazon Lightsail.

  12. (Optional) Scale the capacity of your container service vertically, by increasing its power specification, and horizontally, by increasing its scale specification. For more information, see Changing the capacity of your Amazon Lightsail container services.

  13. Delete your container service if you're not using it to avoid incurring monthly charges. For more information, see Deleting Amazon Lightsail container services.