Table Of Contents


User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . ecr ]



Note: This command is deprecated. Use get-login-password instead.

To log in to an Amazon ECR registry

This command retrieves a token that is valid for a specified registry for 12 hours, and then it prints a docker login command with that authorization token. You can execute the printed command to log in to your registry with Docker. After you have logged in to an Amazon ECR registry with this command, you can use the Docker CLI to push and pull images from that registry until the token expires.


This command displays docker login commands to stdout with authentication credentials. Your credentials could be visible by other users on your system in a process list display or a command history. If you are not on a secure system, you should consider this risk and login interactively. For more information, see get-authorization-token.

See 'aws help' for descriptions of global parameters.


[--registry-ids <value> [<value>...]]
[--include-email | --no-include-email]


--registry-ids (string) A list of AWS account IDs that correspond to the Amazon ECR registries that you want to log in to.

--include-email | --no-include-email (boolean) Specify if the '-e' flag should be included in the 'docker login' command. The '-e' option has been deprecated and is removed in Docker version 17.06 and later. You must specify --no-include-email if you're using Docker version 17.06 or later. The default behavior is to include the '-e' flag in the 'docker login' output.

See 'aws help' for descriptions of global parameters.


To retrieve a Docker login command to your default registry

This example prints a command that you can use to log in to your default Amazon ECR registry.


aws ecr get-login


docker login -u AWS -p <password> -e none https://<aws_account_id>.dkr.ecr.<region>

To log in to another account's registry

This example prints one or more commands that you can use to log in to Amazon ECR registries associated with other accounts.


aws ecr get-login --registry-ids 012345678910 023456789012


docker login -u <username> -p <token-1> -e none <endpoint-1>
docker login -u <username> -p <token-2> -e none <endpoint-2>