blue-sky
blue-sky

Reputation: 53916

Push docker container from locak to aws ecr

When I attempt to push my tagged docker repo to ecr I receive error:

 ->  ~  docker push 169729465422.dkr.ecr.eu-west-1.amazonaws.com:latest                                                                                                                                                                                           1 ↵  1834  00:14:14
The push refers to repository [docker.io/library/169729465422.dkr.ecr.eu-west-1.amazonaws.com]
a41ec2e4dc40: Preparing
62b872ff53d4: Preparing
a628002c2154: Preparing
9f15c5e37d02: Preparing
efdebd147565: Preparing
32411a9a984e: Waiting
1bd26e8168dc: Waiting
ffc9b21953f4: Waiting
denied: requested access to the resource is denied

User has all permissions to push image ? :

enter image description here

I have followed steps to tag image:

aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 169729465422.dkr.ecr.eu-west-1.amazonaws.com

docker tag cda-flask-app:latest 169729465422.dkr.ecr.eu-west-1.amazonaws.com

docker push 169729465422.dkr.ecr.eu-west-1.amazonaws.com

I've configured the CLI using aws configure as per doc https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-quick-configuration . I don't believe I'm missing any steps, yet when I try to push the image i receive permissions issue. Is there an iextra step I need to complete in order to push the image from local to ecr ?

Update:

Using :

docker tag cda-flask-app:latest 169729465422.dkr.ecr.eu-west-1.amazonaws.com       

docker push 169729465422.dkr.ecr.eu-west-1.amazonaws.com/cda-flask-app:latest

returns error:

The push refers to repository [169729465422.dkr.ecr.eu-west-1.amazonaws.com/cda-flask-app]
a41ec2e4dc40: Preparing
62b872ff53d4: Preparing
a628002c2154: Preparing
9f15c5e37d02: Preparing
efdebd147565: Preparing
32411a9a984e: Waiting
1bd26e8168dc: Waiting
ffc9b21953f4: Waiting
name unknown: The repository with name 'cda-flask-app' does not exist in the registry with id '169729465422'

Upvotes: 3

Views: 4559

Answers (2)

Jos
Jos

Reputation: 31

Maybe a bit late, however:

Your ECR repository should be named like your image, so if you push

docker push 169729465422.dkr.ecr.eu-west-1.amazonaws.com/cda-flask-app:latest

then your repository in ECR should be named cda-flask-app too. That is why docker is not finding the right repository.

Upvotes: 3

jmaitrehenry
jmaitrehenry

Reputation: 2420

The problem is with the image name. If should be in the form of repository/image:tag.

In your case it should be 169729465422.dkr.ecr.eu-west-1.amazonaws.com/myimage:latest.

Without the /, docker try to push to the default registry docker.io the image 169729465422.dkr.ecr.eu-west-1.amazonaws.com with latest tag.

And before pushing an image to ECR, you need to create the "repository" into the ECR console with the "Create repository button": ECR Console

Upvotes: 4

Related Questions