Tutorial: Push your image to Amazon ECR - AWS Batch

Tutorial: Push your image to Amazon ECR

Now that you built and tested your Docker container, push it to an image repository. This example uses Amazon ECR, but you can use another registry, such as DockerHub.

  1. Create an Amazon ECR image repository to store your container image. This example only uses the AWS CLI, but you can also use the AWS Management Console. For more information, see Creating a Repository in the Amazon Elastic Container Registry User Guide.

    $ aws ecr create-repository --repository-name print-color
  2. Tag your print-color image with your Amazon ECR repository URI that was returned from the previous step.

    $ docker tag print-color aws_account_id.dkr.ecr.region.amazonaws.com/print-color
  3. Log in to your Amazon ECR registry. For more information, see Registry Authentication in the Amazon Elastic Container Registry User Guide.

    $ aws ecr get-login-password \ --region region | docker login \ --username AWS \ --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com
  4. Push your image to Amazon ECR.

    $ docker push aws_account_id.dkr.ecr.region.amazonaws.com/print-color