【问题标题】:Docker push - net/http: TLS handshake timeoutDocker 推送 - net/http:TLS 握手超时
【发布时间】:2017-04-25 12:41:41
【问题描述】:

我在 AWS EC2 Ubuntu 14.04 实例上部署了一个私有 Docker 映像注册表。注册表使用Let's Encrypt 证书进行保护。

不幸的是,docker push 操作耗时超过 300 秒,我收到了 net/http: TLS handshake timeout

这是time'd 命令的输出:

[luqo33@home-pc containers]$ time docker push <my-registry-domain:5000>/nginx                                                    
The push refers to a repository [<my-registry-domain:5000>/nginx]
dda5a806f0b0: Layer already exists
ec35cfccb7f7: Layer already exists
94c1a232bb3f: Layer already exists
6d6b9812c8ae: Layer already exists
695da0025de6: Retrying in 1 second
fe4c16cbf7a4: Pushing [================================================>  ]   119 MB/123 MB
net/http: TLS handshake timeout

real    5m0.847s
user    0m0.097s
sys     0m0.017s

regsitry:2 容器的日志没有显示任何错误 - 除了在接收数据时出现意外 EOF 的通知。我也可以推送不到 5 分钟的图片,没有问题。

我怀疑这是系统设置造成的,因为超时总是在操作超过 300 秒时发生。没有任何负载均衡器或其他代理。 &lt;my-registry-domain:5000&gt; 直接指向服务器IP。

我该如何进一步调查并采取可能的补救措施?

编辑

当我将图像推送到其他服务器提供商 (DigitalOcean)、AWS ECS 注册表甚至 Docker Hub 时,也会发生同样的情况!我很难相信 Docker 客户端会有 300 秒的内置握手超时。

我在想也许我应该开始在网络级别寻找解决方案 - 使用我的硬件(wi-fi 路由器)或我的 ISP。

有人知道这里发生了什么吗?

【问题讨论】:

    标签: docker docker-registry dockerhub


    【解决方案1】:

    只需为那些可能在基于https://github.com/actions/virtual-environments/issues/2152#issuecomment-736325518的托管构建环境(如 Azure Devops)上处理它的人添加一个单独的答案

    如下更改设置

    sudo sed -i 's/ }/, \"max-concurrent-uploads\": 1 }/' /etc/docker/daemon.json
    sudo systemctl restart docker
    

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题,这个问题可能来自您的互联网连接,我通过 将 dockerd 中的并发上传(get 下载)减少到 1 解决了这个问题。 通过使用这些参数:

      --max-concurrent-downloads  (default: 3)    Set the max concurrent downloads for each pull
      
      --max-concurrent-uploads    (default: 5)    Set the max concurrent uploads for each push
      

      如果您的带宽较低,同时上传 5 张图片可能会导致超时。

      https://docs.docker.com/engine/reference/commandline/dockerd/

      【讨论】:

      • 这对于那些使用带有私有注册表的 Azure Devops 的人来说可能是个问题。由于无法更改守护程序设置。
      • 这个解决方案确实有帮助。 (对于 Linux-Systemd,设置为 /usr/lib/systemd/system/docker.service,然后重新启动服务。)与我们的私有注册表的连接速度非常慢,减少并发上传数量有助于利用少量可用带宽。
      • 就我而言,是我的 VPN 连接阻止了我
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-16
      • 2016-02-08
      • 1970-01-01
      • 2021-11-14
      • 2016-03-19
      • 1970-01-01
      相关资源
      最近更新 更多