aws,

How to fix 'no basic auth credentials' AWS ECR

Aug 11, 2022 · 1 min read · Post a comment

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.

Prerequisites

  • AWS account
  • AWS CLI
  • AWS ECR

Solution

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 aws-account-id.

Conclusion

Tried everything and nothing works? Let me know in the comment section below. On a side note, follow our official channel on Telegram.