AWS docker pull issue

Hi,

I’m having problems pulling a docker from repository in aws.

I always have this error:
Error response from daemon: pull access denied for [repository name], repository does not exist or may require ‘docker login’

I did push the image in repository from my local machine with success.
Now on the server I need to pull it from the repository and run it.
I am using these commands:
aws ecr get-login --no-include-email --region eu-central-1
docker pull [repository name]

I can see my image in ECR->Repositories.
The login seems successful, it’s returning the token after i run it.
I’m using git bash on windows to do all these.
On the server there is a Linux, ubuntu, I connect to it, and I set root access also.

Please help me, I don’t know what else to try.

Thank you

You need to login to your AWS ECR private registry with a docker login command which was displayed by the output of the aws ecr get-login command, before you can pull the docker image from the AWS ECR private registry

According to the AWS documentation -> https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login.html
aws ecr get-login command

This command retrieves a token that is valid for a specified registry for 12 hours, and then it prints a docker login command with that authorization token. You can execute the printed command to log in to your registry with Docker. After you have logged in to an Amazon ECR registry with this command, you can use the Docker CLI to push and pull images from that registry until the token expires.

You need to then issue that docker login command.

I had the same error few days ago and I had the same use case as you . To solve it , I needed to give the following rights to the role that is executing the pull from ECR and adjust the policy ,
“Action”: [
“ecr:GetAuthorizationToken”,
“ecr:BatchCheckLayerAvailability”,
“ecr:GetDownloadUrlForLayer”,
“ecr:GetRepositoryPolicy”,
“ecr:DescribeRepositories”,
“ecr:ListImages”,
“ecr:DescribeImages”,
“ecr:BatchGetImage”,
“ecr:InitiateLayerUpload”,
“ecr:UploadLayerPart”,
“ecr:CompleteLayerUpload”,
“ecr:PutImage”
]
and this was my reference https://docs.aws.amazon.com/AmazonECR/latest/userguide/security_iam_id-based-policy-examples.html