I am trying to push one docker image to my AWS ECR, but i am getting this error during login
Command I used:
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/xxxxxx
Error
failed to get console mode for stdin: The handle is invalid.
Error saving credentials: error storing credentials - err: exit status 1, out: `error storing credentials - err: exit status 1, out: `The stub received bad data.
2
Answers
Split the piped command up into it’s separate commands:
First run
aws ecr-public get-login-password --region us-east-1
and see the password it outputs.Then run the second command, but pass it the password as an argument:
docker login --username AWS --password <password-output-from-previous-command> public.ecr.aws/xxxxxx
This will help you isolate the error you are encountering, and possibly get completely past it.
If you can, I highly recommend using AWS ECR Credentials Helper instead.
Please see the solution https://github.com/Azure/azure-cli/issues/4843#issuecomment-342712079 which worked for me.