Reputation: 233
I am getting this error when I try to push a docker container denied: Your Authorization Token has expired.
I had aws ecr get-login --no-include-email --region us-east-1, I tried the hack someone posted here where you take out the https none have worked.
When I run aws ecr get-login ... I get the code I copy and paste it and get a successful message but when I try to push my docker container I get the denied: Your Authorization Token has expired. I am using docker version Docker version 17.03.1-ce. Any Ideas what I can do?
Thanks!
Upvotes: 5
Views: 10210
Reputation: 1076
Expanding on @Amit Meena's answer because I got caught on this mistake:
You cannot include a repository name in the url.
Bad
aws ecr get-login-password --region <REGION> | docker login --username AWS --password-stdin <AWS_ACCOUNT_NO>.dkr.ecr.<AWS_REGION_NAME>.amazonaws.com/<REPO_NAME>
Good
aws ecr get-login-password --region <REGION> | docker login --username AWS --password-stdin <AWS_ACCOUNT_NO>.dkr.ecr.<AWS_REGION_NAME>.amazonaws.com
Upvotes: 2
Reputation: 391
@Robert's comment (see comment to the question itself) was enough for me. The mistake was that
aws ecr get-login-password --region <REGION> | docker login --username AWS --password-stdin <AWS_ACCOUNT_NO>.dkr.ecr.<AWS_REGION_NAME>.amazonaws.com
was not on sudo, but the actual docker push was.
Upvotes: 1
Reputation: 4444
Please use following command combination:
aws ecr get-login-password --region <REGION> | docker login --username AWS --password-stdin <AWS_ACCOUNT_NO>.dkr.ecr.<AWS_REGION_NAME>.amazonaws.com
Quoting from the documentation:
"This command retrieves and displays an authentication token using the GetAuthorizationToken API that you can use to authenticate to an Amazon ECR registry. You can pass the authorization token to the login command of the container client of your preference, such as the Docker CLI. "
Reference: https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login-password.html
Upvotes: 8
Reputation: 28245
One reason can be the aws-cli version. The version of this CLI tool which seems to be a Python package can be seen in aws --version
. I encountered this error for the version aws-cli/2.1.29
, but not in the older version aws-cli/1.18.40
.
The "aws ecr get-login" command is deprecated, Amazon recommends to use "aws ecr get-login-password" instead.
Upvotes: 0