If you are struggling to get login credentials for ECR authentication to be able to push or pull a Docker image from ECR, then you are probably executing the
aws ecr get-login command. Since AWS announced version 2 of the AWS CLI, this command doesn’t work anymore, and it’s marked as deprecated. Let’s jump to the solution section.
- AWS account
- AWS CLI
- AWS ECR
The following command will make your life easier and you can quickly get the login creds for the ECR authentication.
docker login -u AWS -p $(aws ecr get-login-password --region <region>) <aws-account-id>.dkr.ecr.put-the-region.amazonaws.com
Before executing the command you need to set the proper AWS account using the
aws configure command. Once that is done, the only thing that you need to add in the command is
region line and
Tried everything and nothing works? Let me know in the comment section below. On a side note, follow our official channel on Telegram.