Docker Swarm or ECR? You can enjoy the flavors offered by both just by knowing this simple technique to switch images between them. Deposit the Docker Images in AWS ECR with the help of the steps shown below. 

Without further ado, let’s delve into the details of how to push Docker images into AWS ECR. 

Pushing a Docker Image to Amazon ECR

We have shown the console and the CLI method for pushing a Docker Image to ECR. 

  • Console Method 

Step 1: Navigate to Elastic Container Service >> Amazon ECR >> Repositories. 

Step 2: Click on Create Repository. The repository can be either Private or Public. You can access the Private repository files after authentication. However, this is not necessary for ECR private repositories. Moreover, ECR public repository images are region independent. If you would like to add credentials for Docker private repositories, see Storing Credentials in Secrets Manager (AWS/Storing-Credentials-in-AWS-Secrets Manager)

Step 3: Next, fill in the desired repository name. 

Step 4: Enable tag immutability to prevent the images from being overwritten while pushing to the repository. 

Step 5: Enter any required settings like Scan on Push and KMS Encryption. 

Step 6: Click on Create Repository.

Creating a Repository

Log in to AWS CLI and run the bow command. It will create a private repository in ECR. 

aws ecr create-repository –repository-name nginx –image-tag-mutability IMMUTABLE


{ “repository”: { “repositoryArn”: “arn:aws:ecr:ap-south 1:283624592265:repository/nginx”, “registryId”: “223659242865”, “repositoryName”: “nginx-“, “repositoryUri”: “283624592265.dkr.ecr.ap-south”, “createdAt”: “2021-06-04T18:47:14+05:30”, “imageTagMutability”: “IMMUTABLE”, “imageScanningConfiguration”: { “scanOnPush”: false }, “encryptionConfiguration”: { “encryptionType”: “AES256” } } }

Push Image to Repository

Click on View Push Commands in the AWS console after selecting the desired repository. 

1. Copy and paste the commands shown in the new window. 

2. Retrieve an authentication token and authenticate your Docker client to your registry.

Use the AWS CLI, 

aws ecr get-login-password –region ap-south-1 | docker login –username AWS –password-stdin


WARNING! Your password will be stored unencrypted in /root/.docker/config.json. Configure a credential helper to remove this warning. See store Login Succeeded

3. At this point, we assume that the new docker image is already built. Tag this image to push to the repository. 

docker tag nginx:latest 283624592265.dkr.ecr.ap-south

Finally, push the image to the repository. 

docker push


The push refers to repository [283624592265.dkr.ecr.ap-south] ffff66cac3f0: Pushed 075508cf8f04: Pushed 5c865c78bc96: Pushed 134e19b2fac5: Pushed 83634f76e732: Pushed 766fe2c3fc08: Pushed 02c055ef67f5: Pushed latest: digest: sha256:7fbb24af6ddde922fc6a6d04db27ad9ab3a2c8c77e6d2f62536acd6de8a8f596 size: 1782

Container Image in the Repository 

Open the repository and find the newly uploaded image.

Open the repository and find the newly uploaded image.

You can use this image to fire up containers using Docker, ECS-EC2 instances and ECS Fargate services.

Wrapping Up

Well, with those few straightforward steps, you can push a Docker Image to the AWS ECR. 

At SysAlly, we experiment with Cloud and the most useful information is passed on to the world as blogs. Signup for the updates.

Until later, here’s SysAlly signing off!

Get new insights right to your inbox

How can our experts help you?

Schedule your consultation

You may also like

  • By admin
  • in DevOps

Agile vs DevOps: What’s the difference

  • Nov 18, 2022 .
  • 9 min min
Read More
  • By admin
  • in DevOps

DevOps as a Service: All You Should Know

  • Aug 9, 2022 .
  • 9 min min
Read More
  • By admin
  • in Containerization

Containerization VS Virtualization: Understanding the Differences

  • Aug 4, 2022 .
  • 8 min min
Read More

Be in the know

Techno tips served hot! Subscribe now and stay atop.