[英]docker login: error storing credentials `The stub received bad data.`
First, I installed AWS-CLI and I already used "AWS configure" to set up my secret key and I also used "Docker login" command to log in and I got success and when I typed Get-ECRLoginCommand.首先,我安装了 AWS-CLI,我已经使用“AWS 配置”来设置我的密钥,我还使用“Docker 登录”命令登录,当我输入 Get-ECRLoginCommand 时,我获得了成功。 It works and returns the result for me.
它有效并为我返回结果。
But when I try to use the command:但是当我尝试使用命令时:
(Get-ECRLoginCommand).Password | docker login --username AWS --password-stdin 837859123533.dkr.ecr.ap-east-1.amazonaws.com/spring-boot
I got an error that looks like this:我收到一个看起来像这样的错误:
Error saving credentials: error storing credentials - err: exit status 1, out:
error storing credentials - err: exit status 1, out:
The stub received bad data.``保存凭证时出错:存储凭证时出错 - 错误:退出状态 1,输出:
error storing credentials - err: exit status 1, out:
存根收到错误数据。``
Edit: Also see Ethan Davis's solution:编辑:另见 Ethan Davis 的解决方案:
I found that removing C:\Program Files\Docker\Docker\resources\bin\docker-credential-desktop.exe and C:\Program Files\Docker\Docker\resources\bin\docker-credential-wincred.exe worked for me.
我发现删除 C:\Program Files\Docker\Docker\resources\bin\docker-credential-desktop.exe 和 C:\Program Files\Docker\Docker\resources\bin\docker-credential-wincred.exe 对我有用. – Ethan Davis Sep 29 '20 at 18:10
– 伊桑戴维斯 20 年 9 月 29 日 18:10
Original: The solution linked by Joelster's comment worked for me.原文: Joelster 评论链接的解决方案对我有用。
One quick workaround is to modify .docker\config.json file.
一种快速的解决方法是修改 .docker\config.json 文件。 Remove the following line so docker will use file system to store tokens:
删除以下行,以便 docker 使用文件系统来存储令牌:
"credsStore": "wincred"
I opened the file c:\Users\sashoalm\.docker\config.json
, and I deleted the "credsStore" key.我打开了文件
c:\Users\sashoalm\.docker\config.json
,并删除了“credsStore”键。 After that this worked:之后这工作:
type pass.txt | docker login -u AWS --password-stdin https://123123.dkr.ecr.us-west-1.amazonaws.com
And the output was this:输出是这样的:
WARNING! Your password will be stored unencrypted in C:\Users\sashoalm\.docker\config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
As of today's date, this issue still persists.直到今天,这个问题仍然存在。 Below are the things I discovered-
以下是我发现的东西-
1.) This problem shows up while using SSOs for authentication. 1.) 使用 SSO 进行身份验证时会出现此问题。 I am using Azure SSO for AWS.( https://www.npmjs.com/package/aws-azure-login )
我正在为 AWS 使用 Azure SSO。( https://www.npmjs.com/package/aws-azure-login )
2.) The reason is- The token returned from SSOs is long enough(more than 2550 characters) where as windows credential manager does not support such long tokens. 2.) 原因是 - 从 SSO 返回的令牌足够长(超过 2550 个字符),而 Windows 凭据管理器不支持这么长的令牌。
3.) If you use ECR credential helper ( https://github.com/awslabs/amazon-ecr-credential-helper ), sadly it also does not seem to work with SSOs- https://github.com/awslabs/amazon-ecr-credential-helper/issues/229 3.)如果您使用 ECR 凭证助手( https://github.com/awslabs/amazon-ecr-credential-helper ),遗憾的是它似乎也不适用于 SSO - https://github.com/awslabs/ amazon-ecr-credential-helper/issues/229
However, I followed these steps as a workaround & I'm on Windows-但是,我按照这些步骤作为解决方法&我在 Windows 上-
1.) Remove/Rename the "docker-credential-wincred.exe"
file located in "C:\Program Files\Docker\Docker\resources\bin"
directory. 1.) 删除/重命名位于
"C:\Program Files\Docker\Docker\resources\bin"
目录中的“ "docker-credential-wincred.exe"
文件。
2.) Remove the "credStore"
& "credsStore"
keys from the docker config( C:\Users\PROFILE_NAME\.docker\config.json
). 2.) 从 docker 配置中删除
"credStore"
和"credsStore"
键( C:\Users\PROFILE_NAME\.docker\config.json
)。
I get the following response-我得到以下回应-
WARNING! Your password will be stored unencrypted in C:\Users\sandeep.kumar\.docker\config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
https://github.com/danieljoos/wincred/issues/18 https://github.com/danieljoos/wincred/issues/18
https://github.com/aws/aws-cli/issues/5636 https://github.com/aws/aws-cli/issues/5636
Both solutions worked for me, delete file C: \ Program Files \ Docker \ Docker \ resources \ bin \ docker-credential-desktop.exe and C: \ Program Files \ Docker \ Docker \ resources \ bin \ docker-credential-wincred.两种解决方案都对我有用,删除文件 C:\Program Files\Docker\Docker\resources\bin\docker-credential-desktop.exe 和 C:\Program Files\Docker\Docker\resources\bin\docker-credential-wincred。 exe and delete {"credsStore": "...."} then my structure is as follows in the config.json file
exe 并删除 {"credsStore": "...."} 然后我的结构在 config.json 文件中如下
{
"auths": {
"Account_AWS.dkr.ecr.Region_AWS.amazonaws.com": {
"auth": "My token"
}
},
"HttpHeaders": {
"User-Agent": "Docker-Client / 19.03.13 (windows)"
},
"stackOrchestrator": "swarm"
}
正如@Ethan Davis 提到的,删除以下文件对我有帮助:
C:\Program Files\Docker\Docker\resources\bin\docker-credential-desktop.exe
C:\Program Files\Docker\Docker\resources\bin\docker-credential-wincred.exe
Nothing worked for me, so I installed the The Amazon ECR Docker Credential Helper, so you do not need to docker login
at all.没有什么对我有用,所以我安装了 Amazon ECR Docker Credential Helper,所以你根本不需要
docker login
。
choco install amazon-ecr-credential-helper
Place the docker-credential-ecr-login binary on your PATH and set the contents of your ~/.docker/config.json file to be:将 docker-credential-ecr-login 二进制文件放在 PATH 上,并将 ~/.docker/config.json 文件的内容设置为:
{
"credsStore": "ecr-login"
}
Official Repo: https://github.com/awslabs/amazon-ecr-credential-helper官方回购: https ://github.com/awslabs/amazon-ecr-credential-helper
来自另一个线程 - Mac OS X 解决方案上的 Docker 登录失败有助于 Mac-os: mv ~/.docker ~/.docker.bak
Fixed by just deleted "credsStore": "desktop" in config.json file.通过刚刚删除的 "credsStore": "desktop" 在 config.json 文件中修复。
With the most recent version of Docker amazon-ecr-credential-helper
is installed alongside it.最新版本的 Docker
amazon-ecr-credential-helper
与它一起安装。
So you only need to activate it by modifying your config.json
file, found in %userprofile%/.docker/config.json
or ~/.docker/config.json
.所以你只需要通过修改
config.json
文件来激活它,该文件位于%userprofile%/.docker/config.json
或~/.docker/config.json
中。
Set the contents of your config.json
to be:将
config.json
的内容设置为:
{
"credsStore": "ecr-login"
}
Alternatively you can also set the contents to:或者,您也可以将内容设置为:
{
"auths": {
"XXXXXXXXXXXX.dkr.ecr.ap-east-1.amazonaws.com": {
"auth": ""
}
}
}
(Where XXXXXXXXXXXX is the AWS Account number, ap-east-1 is the region of choice, and auth is left blank). (其中 XXXXXXXXXXXX 是 AWS 账号,ap-east-1 是选择的区域,auth 留空)。
Now if you repeat the docker login --username AWS XXXXXXXXXXXX.dkr.ecr.ap-east-1.amazonaws.com
then it will succeed this time.现在,如果您重复
docker login --username AWS XXXXXXXXXXXX.dkr.ecr.ap-east-1.amazonaws.com
那么这次它将成功。
The full instructions can be found on Amazon's amazon-ecr-credential-helper page.完整的说明可以在亚马逊的amazon-ecr-credential-helper页面上找到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.