我已在 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。
有人知道这里发生了什么吗?
来解决它。
通过使用这些参数:
--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/
ERRO[0042] Error describing service error="RequestError: send request failed\ncaused by: Post https://ecs.us-east-1.amazonaws.com/: net/http: TLS handshake timeout" service=1routing
FATA[0042] RequestError: send request failed
caused by: Post https://ecs.us-east-1.amazonaws.com/: net/http: TLS handshake timeout
检查您的互联网连接/路由。