从OSX,我只是按照您可以在此处找到的指南(详细的重复步骤):https://console.aws.amazon.com/ecs/home?region=us-east-1#/repositories/create
aws-cli / 1.10.24 Python / 2.7.10 Darwin / 15.4.0 botocore / 1.4.15
Docker版本1.11.1,build 5604cbe(新测试版)
一切顺利,直到push命令失败:
没有基本的身份验证凭据
我在这里看到有同样错误的人:Can't push image to Amazon ECR - fails with "no basic auth credentials"不幸的是,我的问题似乎与不匹配的访问密钥有关。我已多次重置它们以进行检查。
以下是我采取的步骤:
➜ eval $(aws ecr get-login --region us-east-1)
Warning: '-e' is deprecated, it will be removed soon. See usage.
Login Succeeded
~/projects/pw/docker/aws-wordpress ‹master ✗› (ruby-2.3.1) (5.11.0) ()
➜ docker build -t testing .
Sending build context to Docker daemon 38.91 kB
Step 1 : FROM wordpress:latest
---> 81aa77247862
...etc...
Removing intermediate container c5849505c95d
Successfully built 63b304c8227a
~/projects/pw/docker/aws-wordpress ‹master ✗› (ruby-2.3.1) (5.11.0) ()
➜ docker tag testing:latest MYACCOUNT.dkr.ecr.us-east-1.amazonaws.com/testing:latest
~/projects/pw/docker/aws-wordpress ‹master ✗› (ruby-2.3.1) (5.11.0) ()
➜ docker push MYACCOUNT.dkr.ecr.us-east-1.amazonaws.com/testing:latest
The push refers to a repository [MYACCOUNT.dkr.ecr.us-east-1.amazonaws.com/testing]
d80ff78e2dbe: Preparing
...etc...
23b28a7c4771: Waiting
6eb35183d3b8: Waiting
no basic auth credentials
答案 0 :(得分:1)
为了能够推送到ecr,您需要登录ecr docker repo。 为此,您需要使用aws configure设置ur访问密钥(具有ecr权限)。
然后执行
eval $(aws ecr get-login --region us-east-1)
一旦成功,你应该看到 登录成功
答案 1 :(得分:0)
作为Shibashis的补充,您可以尝试添加-no-include-email:
eval $(aws ecr get-login --no-include-email | sed 's|https://||')
答案 2 :(得分:0)
为了更加清楚,
在使用push命令之前,您是否从码头码头工人登录过AWS?
如果您想知道如何获取登录cmd,您是否注意到AWS本身通过aws ecr get-login
此命令生成了该命令?
执行docker login -u AWS -p <hashpassword-from-aws-ecr-cmd>
然后做
docker push <ecr-repo-url>
干杯!