首页 > 解决方案 > 已解决 - docker push 到 nexus 注册表(代理后面)以 EOF 结尾

问题描述

我已经尝试了很多,但我找不到解决这个问题的方法。

我在 vthunder a10 代理后面的 centos7 服务器上运行 nexus sonatype (3.21.1-01) docker 映像。
docker login 和 pull 效果很好,但是docker push在重试后失败并出现 EOF。

这里感兴趣的路线:

这里的情况:

  1. 如果我尝试从客户端推送远程服务器上已经存在所有层的图像(但在 nexus 存储库中缺失),它可以工作。

  2. 如果我尝试相同但在同一图像上添加一些差异(例如新标签),它会以这种方式失败:

(9c27e219663c: Layer already exists 
Patch https://proxy.domain.local:8443/v2/test4/blobs/uploads/6862fe60-d63b-4942-bbb6-f403307e677a: EOF)
  1. 如果我直接从 my.server 机器推送,指向 localhost:8443 它可以工作。

  2. 如果我从客户端机器推送一个带有新层的图像,它会在重试后以这种方式失败(对于较小的图像具有相同的行为):

docker push proxy.domain.local:8443/ara
The push refers to repository [proxy.domain.local:8443/ara]
edb7a4f74e22: Retrying in 8 seconds 
de421654540d: Retrying in 8 seconds
-------------
The push refers to repository [proxy.domain.local:8443/ara]
edb7a4f74e22: Pushing [==================================================>]  172.6MB/172.6MB
de421654540d: Pushing [==================================================>]  200.8MB/200.8MB
EOF

这是对wireshark中发生的事情的总结

the.client  my.server   HTTP    316 GET /v2/ HTTP/1.1 
...
my.server   the.client  HTTP    654 HTTP/1.1 401 Unauthorized  (application/json)
...
the.client  my.server   HTTP    442 HEAD /v2/alpine-test/blobs/sha256:95f5ecd24e438e09033c8e69ec136079f8774ab8284f1431f5433a829054b5e7 HTTP/
(asking to nexus if the image is already uploaded)
my.server   the.client  HTTP    493 HTTP/1.1 404 Not Found 
(it isn't)
the.client  my.server   HTTP    437 POST /v2/alpine-test/blobs/uploads/ HTTP/1.1 
(so it start to post the image)
my.server   the.client  HTTP    584 HTTP/1.1 202 Accepted 
...
the.client  my.server   HTTP    437 POST /v2/alpine-test/blobs/uploads/ HTTP/1.1 
...
my.server   the.client  HTTP    584 HTTP/1.1 202 Accepted
..
and so on with some FIN/ACK in the middle until the client stops to send it...

** 在 nexus 服务器日志上,绝对没有关于此的任何痕迹 **

这是 nexus docker compose:

services:

  nexus:
    build:
      context: .
      args:
        DOCKER_GID: ${DOCKER_GID}
        NEXUS_UID: ${NEXUS_UID}
        NEXUS_GID: ${NEXUS_GID}
    restart: always
    environment:
      - NEXUS_UID_GID=${NEXUS_UID_GID}
      - HOSTNAME_DOCKER_NEXUS=${HOSTNAME_DOCKER_NEXUS}
    ports:
      - "8081:8081"
      - "8443:8443"
    user: ${NEXUS_UID_GID}
    hostname: ${HOSTNAME_DOCKER_NEXUS}
    volumes:
      - /var/nexus-data:/nexus-data
      - /etc/hosts:/etc/hosts
      - /var/run/docker.sock:/var/run/docker.sock

你能帮助我吗?

我正在考虑本地机器/docker二进制权限上可能存在的nexus-docker-user权限问题(如果我从localhost尝试它可以工作,是的,但是图像当然已经存储在系统上) - 但我认为它是不太可能。

我也在考虑代理配置问题(更有可能),但我对代理了解不多。

标签: dockerproxypushnexuseof

解决方案


[解决方法] 因为我无法找出问题所在,我最终将代理透明化并配置 nexus 通过它的 jetty.xml、jetty.https 和 nexus.properties 直接在 https 中服务。

直接从码头提供 https 而不是让代理升级连接解决了上述问题。


推荐阅读