简体   繁体   中英

Not able to login to AWS ECR Repository through docker login command

Not able to login to AWS ECR Repository through docker login command. Using command - docker login REPO_URL

After I enter username and password the result is 401 Unauthorized.

What could be the issue?

You need to first request for the authorization token from ECR using AWS CLI and then extract the password from it and then, call docker login command.

Refer - https://docs.aws.amazon.com/cli/latest/reference/ecr/get-authorization-token.html

这样做登录: $(aws ecr get-login --no-include-email --region us-east-1)

In my case this worked:

aws ecr get-login-password
--region
| docker login
--username AWS
--password-stdin <aws_account_id>.dkr.ecr..amazonaws.com

it was on page https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login-password.html

This worked for me:

aws ecr get-login-password \
    --region MYREGION \
| docker login \
    --username AWS \
    --password-stdin ACCOUNTID.dkr.ecr.MYREGION.amazonaws.com

Copy paste it in the terminal and replace the placeholders ( MYREGION and ACCOUNTID )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM