Getting Started with Amazon ECR
Get started with Amazon EC2 Container Registry (Amazon ECR) by creating a repository in the Amazon ECS console. The Amazon ECR first run wizard guides you through the process to get started with Amazon ECR.
Before you begin, be sure that you've completed the steps in Setting Up with Amazon ECR.
A repository is where you store Docker images in Amazon ECR. Every time you push or pull an image from Amazon ECR, you specify the registry and repository location to tell Docker where to push the image to or where to pull it from.
Open the Amazon ECS console repositories page at https://console.aws.amazon.com/ecs/home#/repositories.
For Repository name, enter a unique name for your repository and choose Next step.
Build, tag, and push Docker image
In this section of the wizard, you use the Docker CLI to tag an existing local image (that you have built from a Dockerfile or pulled from another registry, such as Docker Hub) and then push the tagged image to your Amazon ECR registry.
Retrieve the docker login command that you can use to authenticate your Docker client to your registry by pasting the aws ecr get-login command from the console into a terminal window.
The get-login command is available in the AWS CLI starting with version 1.9.15. You can check your AWS CLI version with the aws --version command.
Run the docker login command that was returned in the previous step. This command provides an authorization token that is valid for 12 hours.
When you execute this docker login command, the command string can be visible by other users on your system in a process list (ps -e) display. Because the docker login command contains authentication credentials, there is a risk that other users on your system could view them this way and use them to gain push and pull access to your repositories. If you are not on a secure system, you should consider this risk and log in interactively by omitting the
-poption, and then entering the password when prompted.
(Optional) If you have a Dockerfile for the image to push, build the image and tag it for your new repository by pasting the docker build command from the console into a terminal window. Make sure you are in the same directory as your Dockerfile.
Tag the image for your ECR registry and your new repository by pasting the docker tag command from the console into a terminal window. The console command assumes that your image was built from a Dockerfile in the previous step; if you did not build your image from a Dockerfile, replace the first instance of
with the image ID or image name of your local image to push.
Push the newly tagged image to your ECR repository by pasting the docker push command into a terminal window.