Push image to ECR

Push image to ECR

In this step, we will push the Docker image to the Amazon Elastic Container Registry (ECR) service.

Amazon ECR is a fully managed Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images. Amazon ECR is integrated with Amazon Elastic Container Service (ECS), simplifying your development to production workflow.

  1. Create a new repository in Amazon Elastic Container Registry (ECR).
  • Go to the ECR service. Container

  • Choose Create Container

  • Enter the repository name docker-container-01 and choose Create Container Container

  • Finish creating the repository Container

  1. Configure AWS CLI with your credentials
  • Install AWS CLI using the following command in Command Prompt
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi

Container

  • After the installation is complete, open the Command Prompt and run the following command to check the version of AWS CLI
aws --version

Container

  • Following the instructions to install AWS CLI
  • Next, we will configure the AWS CLI with your credentials using following command
aws configure
  • Enter your Access Key ID, Secret Access Key, Default region name, and Default output format.
AWS Access Key ID [None]: EXAMPLE
AWS Secret Access Key [None]: EXAMPLE
Default region name [None]: us-east-1
Default output format [None]: json
  1. Back to ECR dashboard, choose the repository you created and click on View push commands Container Container
  • You will see the commands to push the Docker image to the repository. Run the commands in the Terminal at the root directory of the project. Container Container

  • Run docker build -t docker-container-01 . Container

  • You can use docker images to review the images that have been built Container

  • After the build completes, tag your image so you can push the image to our repository Container

  • Push your image to the repository Container

  • Reload the ECR dashboard and you will see the image has been pushed to the repository Container