Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't push image to ECR even though login in docker and was successfully

When attempting to push image to ECR, I always get 'no basic auth' error. ECR is in us-east-1.

This is login command

aws ecr get-login --region us-east-1 --no-include-email

I get response like this

docker login -u AWS -p eyJwYXl ... 

I copy this response and run command, than I got this response

Login Succeeded

I assume that I logged in AWS and docker successfully, so I try to push image to ECR

docker push AWSID.dkr.ecr.us-east-1.amazonaws.com/repositoryname

Than response is like this

ed9f73170eb1: Preparing
f26c0d1885c7: Preparing
254cc70ba305: Preparing
6bfcbc08ecad: Preparing
0cb1addb8efc: Preparing
f9109426e338: Waiting
b7f99d06d826: Waiting
24d803cb9c1a: Waiting
25c4f6422338: Preparing
69b416623121: Waiting
0753f0746a0d: Waiting
a20143cd0986: Waiting
3028f693c3e6: Waiting
514a0f74b55d: Waiting
no basic auth credentials

To figure out what causes error, I checked ~/.docker/config.json. my config.json is like this.

{
"auths": {
    "AWSPATH.dkr.ecr.us-east-1.amazonaws.com": {
        "auth": "QVd..},
    "https://index.docker.io/v1/": {}
       },
"HttpHeaders": {
    "User-Agent": "Docker-Client/19.03.5 (darwin)"
}

2 Answers

It seems to be an Authentication issue. Reconfigure your AWS-CLI, maybe that will resolve your issue.

aws configure

https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html

like image 165
Abhishek Kumar Avatar answered Oct 23 '25 20:10

Abhishek Kumar


For me, it was simply missing permissions.

There are a number of permissions related to uploading such as

                "ecr:UploadLayerPart",
                "ecr:InitiateLayerUpload",
                "ecr:CompleteLayerUpload"
                "ecr:PutImage"

I have solved it by adding them to my agent's allowed permissions.

like image 34
obax Avatar answered Oct 23 '25 19:10

obax