I\'m trying to push a docker image to an Amazon ECR registry. I\'m using docker client Docker version 1.9.1, build a34a1d5
. I use aws ecr get-login --regi
This error generally gets thrown if ecr login has failed. I am using windows system and I used "Powershell" in Administrator mode to login to ecr first.
Invoke-Expression $(aws ecr get-login --no-include-email)
This should output "Login succeeded".
I ran into this issue as well running on OSX. I saw Oliver Salzburg's response and checked my ~/.docker/config.json. It had multiple authorization credentials inside it from the different AWS accounts I have. I deleted the file and after running get-login again it worked.
Since AWS CLI version 2 - aws ecr get-login
is deprecated and the correct method is aws ecr get-login-password.
Therefore the correct and updated answer is the following:
docker login -u AWS -p $(aws ecr get-login-password --region us-east-1) xxxxxxxx.dkr.ecr.us-east-1.amazonaws.com
If you use multiple profiles and you need to login to a profile that is not your default one, you need to login with this command:
$(AWS_PROFILE=<YOUR PROFILE> aws ecr get-login --no-include-email --region eu-west-1)
There is a very simple way to push docker images to ECR: Amazon ECR Docker Credential Helper. Just install it according to the provided guide, update your ~/.docker/config.json
as the following:
{
"credsStore": "ecr-login"
}
and you will be able to push/pull your images without docker login
.
Following command works for me:
sudo $(aws ecr get-login --region us-east-1 --no-include-email)
And Then I run these commands:
sudo docker tag e9ae3c220b23(image_id) aws_account_id.dkr.ecr.region.amazonaws.com/my-web-app
sudo docker push aws_account_id.dkr.ecr.region.amazonaws.com/my-web-app