简体   繁体   English

登录尝试 Nexus OSS Docker 存储库抛出 404

[英]Login attempts to Nexus OSS Docker repo throwing 404

We are trying to set up a Docker repository in Nexus OSS (v3.3.2-02) in a Kubernetes cluster, and having issues logging in to it.我们正在尝试在 Kubernetes 集群中的 Nexus OSS (v3.3.2-02) 中设置 Docker 存储库,但在登录时遇到问题。 We are intending to have a proxy set up for DockerHub, a private repo, and a group repo to tie the two together, using the below configurations我们打算使用以下配置为 DockerHub 设置一个代理、一个私有存储库和一个组存储库以将两者联系在一起

Hosted托管

Proxy代理在此处输入图片说明

Group集团在此处输入图片说明

giving us the following list:给我们以下清单:

在此处输入图片说明

But when I try to log in to the repository, it appears it's trying to forward me to a /v2 endpoint, which is throwing a 404 error:但是当我尝试登录存储库时,它似乎试图将我转发到/v2端点,该端点引发了 404 错误:

> docker login -u <user> -p <pass> https://repo.myhost.com:443
Error response from daemon: login attempt to https://repo.myhost.com:443/v2/ failed with status: 404 Not Found

I would like to add that we have Maven and NPM repositories set up in this same instance and they're working, so it appears Nexus itself is OK, but there's something wrong with the Docker configuration.我想补充一点,我们在同一个实例中设置了 Maven 和 NPM 存储库并且它们正在工作,所以看起来 Nexus 本身没问题,但是 Docker 配置有问题。

I don't know why this request is trying to send me to the /v2 endpoint when trying to log in. What am I missing?我不知道为什么这个请求在尝试登录时试图将我发送到/v2端点。我错过了什么?

Docker requires very specific URL layout and does not allow for any context URL hence the need for Docker connectors to allow Docker client to connect to NXRM. Docker 需要非常具体的 URL 布局,并且不允许任何上下文 URL,因此需要 Docker 连接器来允许 Docker 客户端连接到 NXRM。 Your screenshot shows you have configured Docker connector for your Docker hosted repository on port 444, but your terminal capture shows you're attempting to connect on port 443 which isn't your Docker connector port.您的屏幕截图显示您已在端口 444 上为 Docker 托管存储库配置了 Docker 连接器,但您的终端捕获显示您正在尝试连接端口 443,这不是您的 Docker 连接器端口。 The error message you have suggest your NXRM server indeed runs on port 443, but because of how Docker works you need to access it using port 444. Please try: docker login -u <user> -p <pass> https://repo.myhost.com:444 so it attempts to use your Docker connector port.您的错误消息表明您的 NXRM 服务器确实在端口 443 上运行,但由于 Docker 的工作方式,您需要使用端口 444 访问它。请尝试: docker login -u <user> -p <pass> https://repo.myhost.com:444因此它会尝试使用您的 Docker 连接器端口。 Also, it's always a good idea to run the latest version of Nexus.此外,运行最新版本的 Nexus 总是一个好主意。

In an experiment I just ran (docker-machine, virtualbox, macOS), when the server was 1.13.1 (as was the docker cli), it made a graceful degradation from /v2 down to /v1 , like so:在我刚刚运行的一个实验中(docker-machine、virtualbox、macOS),当服务器是 1.13.1(就像 docker cli)时,它从/v2优雅地降级到/v1 ,如下所示:

level=debug msg="Calling GET /_ping"
level=debug msg="Calling GET /v1.26/version"
level=debug msg="Calling GET /_ping"
level=debug msg="Calling GET /v1.26/version"
level=debug msg="Calling GET /_ping"
level=debug msg="Calling GET /v1.26/info"
level=debug msg="Calling POST /v1.26/auth"
level=debug msg="attempting v2 login to registry endpoint https://192.168.2.103:9999/v2/"
level=info msg="Error logging in to v2 endpoint, trying next endpoint: Get https://192.168.2.103:9999/v2/: EOF"
level=debug msg="attempting v1 login to registry endpoint https://192.168.2.103:9999/v1/"
level=info msg="Error logging in to v1 endpoint, trying next endpoint: Get https://192.168.2.103:9999/v1/users/: dial tcp 192.168.2.103:9999: getsockopt: connection refused"
level=error msg="Handler for POST /v1.26/auth returned error: Get https://192.168.2.103:9999/v1/users/: dial tcp 192.168.2.103:9999: getsockopt: connection refused"

but after I upgraded the server to 17.06.0-ce (still with 1.13.1 cli), it only attempted /v2 and then quit:但是在我将服务器升级到 17.06.0-ce(仍然使用 1.13.1 cli)之后,它只尝试/v2然后退出:

level=debug msg="Calling GET /_ping"
level=debug msg="Calling GET /_ping"
level=debug msg="Calling GET /v1.30/version"
level=debug msg="Calling GET /_ping"
level=debug msg="Calling GET /v1.30/info"
level=debug msg="Calling POST /v1.30/auth"
level=debug msg="attempting v2 login to registry endpoint https://192.168.2.103:9999/v2/"
level=info msg="Error logging in to v2 endpoint, trying next endpoint: Get https://192.168.2.103:9999/v2/: tls: oversized record received with length 21584"
level=error msg="Handler for POST /v1.30/auth returned error: Get https://192.168.2.103:9999/v2/: tls: oversized record received with length 21584"

So the answer appears to be that one either needs to teach Nexus to respond correctly to the /v2 endpoints (as it really should be doing already), or downgrade the dockerd back down to a version that speaks the /v1 api if that is the behavior you're after因此,答案似乎是要么需要教 Nexus 正确响应/v2端点(因为它确实应该已经这样做了),要么将 dockerd 降级回使用/v1 api 的版本,如果这是你所追求的行为

Not sure if this is going to help, but the browser based URL does not have port number in it, and could login with my credentials.不确定这是否会有所帮助,但基于浏览器的 URL 中没有端口号,并且可以使用我的凭据登录。 Example browser based URL below.下面是基于浏览器的示例 URL。

https://nexus.mysite.net/ https://nexus.mysite.net/

However I had to key in the following但是我必须输入以下内容

docker login -u -p https://nexus.mysite.net/码头工人登录 -u -p https://nexus.mysite.net/

I am greeted with the following我受到以下欢迎

Error response from daemon: login attempt to https://nexus.mysite.net/v2/ failed with status: 404 Not Found来自守护程序的错误响应:登录尝试https://nexus.mysite.net/v2/失败,状态为:404 Not Found

Giving the right port number did not show up the above error and I could login from the CLI as follows.提供正确的端口号并没有显示上述错误,我可以从 CLI 登录,如下所示。

docker login -u the-user-name -p the-password https://nexus.mysite.net:7000 docker login -u the-user-name -p the-password https://nexus.mysite.net:7000

(in my case the correct port number was 7000). (在我的情况下,正确的端口号是 7000)。

Hope this helps.希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM