无法将图像推送到Amazon ECR - 使用“无基本身份验证凭据”失败 [英] Can't push image to Amazon ECR - fails with "no basic auth credentials"

查看:803
本文介绍了无法将图像推送到Amazon ECR - 使用“无基本身份验证凭据”失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将码头图像推送到Amazon ECR注册表。我使用Docker客户端Docker版本1.9.1,构建a34a1d5。我使用aws ecr get-login --region us-east-1获取docker登录信誉。然后,我按照以下方式成功登录:

I'm trying to push a docker image to an Amazon ECR registry. I'm using docker client Docker version 1.9.1, build a34a1d5. I use "aws ecr get-login --region us-east-1" to get the docker login creds. I then successfully login with those creds as follows:

docker login -u AWS -p XXXX -e none https://####.dkr.ecr.us-east-1.amazonaws.com
WARNING: login credentials saved in /Users/ar/.docker/config.json
Login Succeeded

但是,当我尝试推我的图像时,会出现以下错误:

But when I try to push my image I get the following error:

$ docker push ####.dkr.ecr.us-east-1.amazonaws.com/image:latest
The push refers to a repository [####.dkr.ecr.us-east-1.amazonaws.com/image] (len: 1)
bcff5e7e3c7c: Preparing 
Post https://####.dkr.ecr.us-east-1.amazonaws.com/v2/image/blobs/uploads/: no basic auth credentials

我确保aws用户具有正确的权限。我还确保存储库允许用户推送它。只是为了确保这不是一个问题,我设置注册表以允许所有用户完全访问。没有任何更改无基本身份凭证错误。我不知道如何开始调试,因为所有流量都被加密。

I made sure that the aws user had the correct permissions. I also made sure that the repository allowed that user to push to it. Just to make sure that wasn't an issue I set the registry to allow all users full access. Nothing changes the "no basic auth credentials" error. I don't know how to begin to debug this since all the traffic is encrypted.

更新

所以我有一点荷马辛普森D'哦的时刻,当我意识到我的问题的根本原因。我可以访问多个AWS帐户。即使我使用aws配置来设置我设置我的存储库的帐户的凭据,aws cli实际上是使用环境变量AWS_ACCESS_KEY_ID和AWS_SECRET_ACCESS_KEY。所以当我做了ecr get-login,它返回一个登录错误的帐户。我没有注意到帐号不同,直到我刚回来尝试一些建议的答案。当我删除环境变量时,一切正常。我猜这个故事的座右铭是如果你遇到这个错误,请确保您登录的存储库与您应用于图像的标签相匹配。

推荐答案

如果您运行 $(aws ecr get-login --region us-east-1)

这篇关于无法将图像推送到Amazon ECR - 使用“无基本身份验证凭据”失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆