Repository navigation
Closed
Labels
closing-soonThis issue will automatically close in 4 days unless further comments are made.This issue will automatically close in 4 days unless further comments are made.guidanceQuestion that needs advice or information.Question that needs advice or information.
Description
I just run the get-login command
execute the output (which returns login succeeded)
then try to push a docker image
then I get the message:
denied: Your Authorization Token has expired. Please run 'aws ecr get-login' to fetch a new one.
I don't know whats going wrong, I'm pushing to the right repo, the time on my mac is correct.
This was working before, but since I reinstalled my mac and upgraded to macOS Sierra it's not working anymore, probably related to that.
My --version output:
aws-cli/1.11.34 Python/2.7.10 Darwin/16.3.0 botocore/1.4.91
$ aws ecr get-login --region eu-west-1 --profile ss
docker login -u AWS -p AQECAHh....b6Wk -e none https://1234567890.dkr.ecr.eu-west-1.amazonaws.com
$ docker login -u AWS -p AQECAHh....b6Wk -e none https://1234567890.dkr.ecr.eu-west-1.amazonaws.com
Flag --email has been deprecated, will be removed in 1.13.
Login Succeeded
$ docker push 1234567890.dkr.ecr.eu-west-1.amazonaws.com/service-web:latest
The push refers to a repository [1234567890.dkr.ecr.eu-west-1.amazonaws.com/service-web]
c1f87971dfa9: Preparing
2eb644aea3de: Preparing
9c8843ffe48e: Preparing
39bb58d049d4: Preparing
f053bc969599: Preparing
7169084246b8: Waiting
bb134a1936fd: Waiting
184e76848a1c: Waiting
75c8fcf65748: Waiting
eb9b9ee1ea58: Waiting
f4bf35723edd: Waiting
ddffe1a64b3c: Waiting
fd1a1154db16: Waiting
b542e946067a: Waiting
d49ed2a5e1ed: Waiting
bb39b980367a: Waiting
25b8358d062f: Waiting
997eee521fc7: Waiting
50b5447183a8: Waiting
4339b5cb0e1d: Waiting
3dbd4a53b21b: Waiting
2bec16216500: Waiting
b9fd8e264df6: Waiting
b6ca02dfe5e6: Waiting
denied: Your Authorization Token has expired. Please run 'aws ecr get-login' to fetch a new one.
Metadata
Metadata
Assignees
Labels
closing-soonThis issue will automatically close in 4 days unless further comments are made.This issue will automatically close in 4 days unless further comments are made.guidanceQuestion that needs advice or information.Question that needs advice or information.
Activity
JordonPhillips commentedon Dec 29, 2016
Presumably this is the same as this StackOverflow question. Can you confirm whether the answer there worked or not?
kyleknap commentedon Jan 18, 2017
Closing due to inactivity. Please reopen if you have anymore questions or the suggestion did not work.
lu3do commentedon Jan 19, 2017
For people with the same issue, check my stackoverflow question/answer:
http://stackoverflow.com/a/41387519/1362815
LusciousPear commentedon Apr 10, 2017
FYI, this is happening to me. Same symptoms. It worked fine for months but now I get the same error message.
Docker version 17.03.1-ce, build c6d412eawscli (1.11.75)philpalmieri commentedon Jun 23, 2017
Im getting same issue.. worked fine for months..
Docker version 17.03.1-ce, build c6d412e
aws-cli/1.11.111 Python/2.7.10 Darwin/16.6.0 botocore/1.5.74
ericblade commentedon Oct 9, 2017
Same here,
Docker version 17.09.0-ce, build afdb6d4
aws-cli/1.11.167 Python/2.7.9 Windows/8 botocore/1.7.25
probably worthy of noting, i'm actually using win10, but aws cli doesn't seem to identify that correctly.
... turns out, profile switch is required, despite [default] and [user1] having identical configurations. Also specifying --profile default fails. Looks like you must use a named profile that isn't default, for get-login to give something that actually works, instead of just reporting that it worked.
Spechal commentedon Oct 12, 2017
Upgraded docker yesterday, hosed today.
Docker version 17.09.0-ce, build afdb6d4
macOS 10.13 High Sierra
awscli (1.11.169)
$(aws ecr get-login --no-include-email)
Error saving credentials: error storing credentials - err: exit status 1, out:
The user name or passphrase you entered is not correct.Creating a different profile than "default" and trying to use that results in the same error.
aws ecr get-login --no-include-email --region=us-east-1 --profile=aws
...
Error saving credentials: error storing credentials - err: exit status 1, out:
The user name or passphrase you entered is not correct.Ultimately, deleting the osxkeychain entries, reinstalling docker and aws-cli and restarting the box resolved my authentication issue.
guppie70 commentedon Nov 19, 2017
For me the issue was solved after adding
--no-include-emailin the aws ecr get-login command.Like this:
eval $( aws ecr get-login --no-include-email --region eu-west-1 )chetanhomify commentedon Mar 4, 2018
In my case the issue was multiple credentials in ~/.aws/credentails so I used --profile
aws ecr get-login --no-include-email --region us-east-2 --profile xxxxThis worked for me.
tekumara commentedon Aug 25, 2018
docker login stores its auth credentials in
~/.docker/config.json. TheYour Authorization Token has expired errormeans those credentials are stale.Try removing
~/.docker/config.json.docker pushshould now generate ano basic auth credentialserror.aws ecr get-login --no-include-emailwill generate adocker logincommand. Check the login command generated is for the same registry used in thedocker pushcommand.axozoid commentedon Nov 13, 2018
I truly have multiple accounts and this helped me! Thanks man!
2 remaining items
michaeljaszczuk commentedon May 9, 2019
Had the same problem.
Just copy output that you have after aws ecr get-login --no-include-email and remove 'https://'. Works for me.
docker login -u AWS -p {token} 123456789.dkr.ecr.eu-west-2.amazonaws.com
stieg commentedon May 16, 2019
Removal of
~/.docker/config.jsonis what did it for me. See https://stackoverflow.com/a/45938500/1664453rgil90 commentedon Mar 29, 2020
Here's what worked for me:
rm ~/.docker/config.json- Removes docker config JSONaws ecr get-login- Exclude the--no-include-email-e nonepart.docker pushcommandjoseph-zhong commentedon Apr 3, 2020
Why not just ask people to run
$(aws ecr get-login --no-include-email)?subhadeepkaran commentedon May 15, 2020
@joseph-zhong that certainly doesn't works for
aws-cli/2.0.0 Python/3.8.1 Darwin/19.4.0 botocore/2.0.0dev4subhadeepkaran commentedon May 15, 2020
What worked for was to do re-login.
If you are on
aws-cli/2.0.0then following might work for you as well.aws ecr get-login-password |docker login --username AWS --password-stdin $IMAGE_PATHstefaniaive commentedon May 15, 2020
https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login-password.html
rklahnaisera commentedon May 31, 2020
Just a casual note: "ecr get-login" disappeared in version 2 of the AWS CLI. This is actually kind of a good thing, it's a little bit of a security risk.
You now have to use "ecr get-login-password"
webxiaohua commentedon Jun 18, 2020
https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login-password.html
The password is valid for 12 hours.
tvkit commentedon Sep 27, 2020
I too verified the returned token had a 12 hour lifespan, so the token is valid.
From what I can tell, this is a Docker issue/behavior.
I'm in the process of switching over to python instead of the CLI. In order to get passed this "expired" issue, it was necessary to hide/delete the ~/.docker/config.json file.
Here's what I found:
Given the following CLI operation:
the operation is generating the config.json file which describes a credentials store for the given endpoint; i.e., wincred
The python operation
dkr.login(...)was effectively picking up the wincred from the config.json instead of the STS creds just acquired from AWS. Apparently, this is a feature and not a bug*.Despite the older creds reference by config.json, the
dkr.login(...)operation didn't fail. Failure only occurred at the point ofdkr.images.push(...).* A feature.... Reviewing the docker/docker-py repo @ github, it seems the
login(...)operation is utilizing the existing config.json file if it already exists. Here's one of many locations where the existing config.json is being referenced/utilitized: sourceSetting the reauth
login(...)option forces the real login operation to execute -- subsequently the config file was regenerated by something.The login operation also permits an alternate config file which is probably the way to go for CI.
Here's another starting point to review what's going on: load_config
Revert cached parallel builds (aws#2351)
feat: Cached and Parallel build implementation (aws#2351) (aws#2357)
sujeethkanuganti commentedon Mar 30, 2022
My issue: If you run aws ecr get-login-password without sudo and docker push with sudo, you will get this error. Run both commands with sudo.
MuralidaranCT commentedon Jun 12, 2022
You are correct sujeethkanuganti
Fixed after removing sudo
tranvansang commentedon Oct 10, 2024
none of above solutions work for me.
In my case, I had to
docker logout <ecr repo URL>once, and re-login to make it work.