我正在尝试使用JSON Key file登录到Windows 10上的Google容器注册表。我在Mac上没有问题,因此密钥文件肯定有效。
首先,我遇到了使用docker登录功能接受JSON密钥文件内容的问题。我已经尝试在CMD中运行“/ set / p PASS ...”命令,我在Powershell中尝试了类似的东西:
docker login -u _json_key -p“$(Get-Content keyfile.json)”https://gcr.io
这些都会导致错误或:
“docker login”最多需要1个参数。
由于我无法使用它,我跑了:
docker login -u _json_key https://gcr.io
然后手动删除JSON文件中的所有中断,将其复制到剪贴板并在提示输入密码时将其粘贴。
这导致:
登录成功
问题解决了!对?
显然不是。我仍然无法拉动我的图像,当我运行码头信息时,列出的唯一注册表是“https://index.docker.io/v1/”。
我尝试启动Powershell作为管理员,并重新启动并重置docker但似乎没有任何帮助。
有人知道发生了什么事吗?我该如何调试?
我正在运行Docker版本17.12.0(稳定)
我发现了一个适用于Windows(在PowerShell中)和bash的解决方案。秘密是使用"provide a password using stdin"。
cat gcr_registry-ro.json | docker login -u _json_key --password-stdin https://gcr.io
Login Succeeded
帮助文字和版本:
PS C:\Users\andy> docker login --help
Usage: docker login [OPTIONS] [SERVER]
Log in to a Docker registry
Options:
-p, --password string Password
--password-stdin Take the password from stdin
-u, --username string Username
PS C:\Users\andy> docker -v
Docker version 18.06.1-ce, build e68fc7a
PS C:\Users\andy>
我现在通过使用我删除密钥中的所有换行符,复制它然后在我提示输入密码时粘贴它,而不是尝试将其传递到-p参数。结果我不得不将网址更改为eu.gcr.io而不仅仅是gcr.io.
我在GCR文档页面上写了一些反馈 - 希望他们能解决它,甚至可能在Powershell中添加正确的方法。
我唯一想知道的是为什么我看不到我在码头工具信息中登录GCR。