Docker push - net / http:TLS握手超时

时间:2016-12-09 23:41:19

标签: docker docker-registry dockerhub

我在AWS EC2 Ubuntu 14.04实例上部署了私有docker镜像注册表。使用Let's Encrypt证书保护注册表。

不幸的是,对于花费超过300秒的net/http: TLS handshake timeout次操作,我得到docker push

这是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秒,超时就会发生。没有任何负载均衡器或其他代理。 <my-registry-domain:5000>直接指向服务器IP。

我如何进一步调查和解决这种情况?

修改

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

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

任何人都知道这里发生了什么?

2 个答案:

答案 0 :(得分:3)

我遇到了同样的问题,这个问题可能来自你的网络连接,我通过将dockerd中的并发上传(下载获取)减少到1 解决了这个问题。 通过使用这些args:

--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/

答案 1 :(得分:0)

只需为可能在基于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
相关问题