简体   繁体   English

将 docker 容器从 locak 推送到 aws ecr

[英]Push docker container from locak to aws ecr

When I attempt to push my tagged docker repo to ecr I receive error:当我尝试将标记的 docker 存储库推送到 ecr 时,我收到错误:

 ->  ~  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?用户拥有推送图片的所有权限? :

在此处输入图像描述

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 .我已经按照文档https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-quick-configuration使用aws configure配置了 CLI。 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?为了将图像从本地推送到 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'

The problem is with the image name.问题在于图像名称。 If should be in the form of repository/image:tag .如果应该是repository/image:tag的形式。

In your case it should be 169729465422.dkr.ecr.eu-west-1.amazonaws.com/myimage:latest .在您的情况下,它应该是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. 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 之前,您需要使用“创建存储库按钮”在 ECR 控制台中创建“存储库”: ECR 控制台

Maybe a bit late, however:然而,也许有点晚了:

Your ECR repository should be named like your image, so if you push你的 ECR 存储库应该像你的镜像一样命名,所以如果你推送

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.那么您在 ECR 中的存储库也应该命名为cda-flask-app That is why docker is not finding the right repository.这就是为什么 docker 没有找到正确的存储库的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM