繁体   English   中英

docker 推送到 nexus 注册表(代理后)以 EOF 结尾

[英]docker push to nexus registry (behind proxy) ends with EOF

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

我在 vthunder a10 代理后面的 centos7 服务器上运行 nexus sonatype (3.21.1-01) docker 映像。
docker 登录和拉取效果很好,但docker 在重试后会出现 EOF 推送失败

这里感兴趣的路线:

  • docker 镜像端口 8081 > my.server:8081
  • docker 镜像端口 8443 > my.server:8443
  • proxy.domain.local:443 > my.server:8081
  • proxy.domain.local:8443 > my.server:8443
  • 我在 nexus 中创建了一个 docker 存储库,其中http 连接器暴露在 8443
  • 代理暴露在 ssl 下,带有自签名证书
  • 客户端的 /etc/docker/daemon.json 文件包含不安全的注册表选项:
    "insecure-registries": ["proxy.domain.local:8443","proxy.domain.local"]

这里的情况:

  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 组成:

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尝试它可以工作,是的,但是图像当然已经存储在系统上) - 但我认为它是不太可能。

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

[解决方法] 因为我无法解决问题,所以我最终通过它的 jetty.xml、jetty.Z5E056C500A1C4B6BADE.5Z10 和 nexusB50D807BADE5Z 使代理透明并配置 nexus 直接在 https 中服务

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

暂无
暂无

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

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