gpt4 book ai didi

docker - 为什么 "docker login"在 Docker 快速启动终端中失败,但在默认机器中工作?

转载 作者:IT老高 更新时间:2023-10-28 21:25:21 25 4
gpt4 key购买 nike

我已经在 Windows 8.1 中安装了 Docker Toolbox,并且一直在按照安装教程进行操作。当到达您 create and push your own imag 的步骤时e,当我尝试运行 docker login ... 时出现此错误。

### VIA Docker Quickstart Terminal
### docker login --username=myuser --password="mypass" --email=myemail@gmail.com
time="2015-11-17T03:20:58.160803558Z" level=debug msg="Calling POST /v1.21/auth"
time="2015-11-17T03:20:58.160838971Z" level=info msg="POST /v1.21/auth"
time="2015-11-17T03:20:58.169033324Z" level=debug msg="hostDir: /etc/docker/certs.d/https:/registry-win-tp3.docker.io/v1"
time="2015-11-17T03:20:58.169071565Z" level=debug msg="pinging registry endpoint https://registry-win-tp3.docker.io/v1/"
time="2015-11-17T03:20:58.169084660Z" level=debug msg="attempting v1 ping for registry endpoint https://registry-win-tp3.docker.io/v1/"
time="2015-11-17T03:20:58.898542338Z" level=debug msg="Error unmarshalling the _ping PingResult: invalid character '<' looking for beginning of value"
time="2015-11-17T03:20:58.898803841Z" level=debug msg="PingResult.Version: \"\""
time="2015-11-17T03:20:58.898818084Z" level=debug msg="Registry standalone header: ''"
time="2015-11-17T03:20:58.898836197Z" level=debug msg="PingResult.Standalone: true"
time="2015-11-17T03:20:58.898853685Z" level=debug msg="attempting v1 login to registry endpoint https://registry-win-tp3.docker.io/v1/"
time="2015-11-17T03:20:59.478756938Z" level=error msg="Handler for POST /v1.21/auth returned error: Unexpected status code [403] : <html><body><h1>403 Forbidden</h1>\nRequest forbidden by administrative rules.\n</body></html>\n\n"
time="2015-11-17T03:20:59.478815334Z" level=error msg="HTTP Error" err="Unexpected status code [403] : <html><body><h1>403 Forbidden</h1>\nRequest forbidden by administrative rules.\n</body></html>\n\n" statusCode=500

为了解决这个问题,我尝试在 Docker 默认虚拟机中运行 docker login ...。它在那里工作!

### VIA default virtual machine (192.168.99.100)
### docker login --username=myuser --password="mypass" --email=myemail@gmail.com https://index.docker.io/v1/
time="2015-11-17T03:20:46.053333255Z" level=debug msg="Calling POST /v1.21/auth"
time="2015-11-17T03:20:46.053404176Z" level=info msg="POST /v1.21/auth"
time="2015-11-17T03:20:46.082796012Z" level=debug msg="hostDir: /etc/docker/certs.d/https:/index.docker.io/v1"
time="2015-11-17T03:20:46.082930763Z" level=debug msg="pinging registry endpoint https://index.docker.io/v1/"
time="2015-11-17T03:20:46.082946790Z" level=debug msg="attempting v1 ping for registry endpoint https://index.docker.io/v1/"
time="2015-11-17T03:20:46.082959103Z" level=debug msg="attempting v1 login to registry endpoint https://index.docker.io/v1/"

我注意到他们使用了两个不同的 URL,并且第一个遇到了解析错误。凭据显然是正确的,因为它们在 VM 内工作,除非两个域不共享用户。 MINGW64 是否破坏了 URL 或响应?

最佳答案

2016 年 2 月更新

PR 19891 "Enable cross-platforms login to Registry"应该可以解决问题

Use a daemon-defined Registry URL for docker login.

This allows a Windows client interacting with a Linux daemon to properly use the default Registry endpoint instead of the Windows specific one.

它在 commit 19eaa71 (也许适用于 docker 1.10?)


这在 docker/docker issue 15612 中都有报道和 docker/docker issue 18019

After some analysis of the source code I’ve detected that we have different registry URLs for Windows and UNIX.

Windows url 来自 recent PR 15417附评论:

// Currently it is a TEMPORARY link that allows Microsoft to continue
// development of Docker Engine for Windows.

因此,此 url 可能不起作用(除非您使用的是最新的 Windows Server 2016)


docker/hub-feedback issues 473 中似乎有一个解决方法,其中涉及:

  • 指定docker io的默认索引注册表,

    docker login --username=myuser --password=mypassword --email=myemail https://index.docker.io/v1/
    WARNING: login credentials saved in C:\Users\myuser\.docker\config.json
    Login Succeeded
  • 修改上一步创建的 config.json 文件,以便为 添加与 index.docker.io 相同的凭据注册表-win:

config.json:

{
"auths": {
"https://index.docker.io/v1/": {
"auth": "myhash",
"email": "myemail"
},
"https://registry-win-tp3.docker.io/v1/": {
"auth": "myhash",
"email": "mydomain"
}
}
}

之后,docker push index.docker.io/myuser/myrepo:latest 就可以工作了。

关于docker - 为什么 "docker login"在 Docker 快速启动终端中失败,但在默认机器中工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33748919/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com