How to upload a Docker image to ECR using AWS CLI

Csaba Boros
3 min readMar 9, 2024

In this quick tutorial I will show you how to set up a ECR repository using the AWS Console then upload a Docker image to the repository using the AWS CLI manually. In production you would most probably integrate this as part of your CI/CD pipeline but this tutorial will give you a good idea of the necessary steps you will need to take.

Docker image to ECR

Create a new ECR repository using the AWS Console

First step is to create a repository. Search for Elastic Container Repository and click on the Get Started button. The only information that you need to provide at this step is to give a name to your repository. Mine will be tutorial-repository.

Create ECR repository

Create an IAM user with proper permissions

It’s best practice to create an IAM user with the least permissions to use as part of your CI/CD pipeline to run the CLI commands so let’s setup a new IAM user for this task.

Search for IAM, click on Users and Create user. I will name mine tutorial-ecr-uploader. Click next and then select the “Attach policies directly”. The policy we need is…

--

--