Docker 无法在代理 TLS 握手超时后拉取镜像

问题描述 投票:0回答:6

我在 CentOS 7 上安装了最新的 Docker 版本 18.06.0。 我的服务器位于公司网络中,因此使用代理服务器来访问注册表。 我已经按照 docker 文档添加了代理设置。 但最终添加代理设置部分起作用。即现在 docker 使用代理在运行之前拉取镜像。

但是现在失败并给出以下错误:

$ sudo docker run hello-world
Unable to find image ‘hello-world:latest’ locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: net/http: TLS handshake timeout.

另外,登录失败:

$ sudo docker login --username=XXXX
Password:
Error response from daemon: Get https://registry-1.docker.io/v2/: proxyconnect tcp: EOF

我的代理速度非常快。当我使用它使用 wget 或 curl 从互联网下载任何内容时,我看到 90 到 100Mbps 的速度。 我的机器上的其他应用程序实用程序(例如 yum)正在完美地使用此代理,并且运行良好。 现在不知道为什么只有Docker下载镜像有问题

安装配置详情如下:

版本:

$ sudo docker version
Client:
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:08:18 2018
OS/Arch: linux/amd64
Experimental: false

服务器:

Engine:
Version: 18.06.0-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:10:42 2018
OS/Arch: linux/amd64
Experimental: false

操作系统版本:

Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511

Docker 代理配置:

$ cat /etc/systemd/system/docker.service.d/https-proxy.conf
[Service]
Environment=“HTTP_PROXY=http://pqr.corp.xxx.com:8080”
Environment=“HTTPS_PROXY=https://pqr.corp.xxx.com:8080”
Environment=“NO_PROXY=localhost,127.0.0.1”

添加此配置后我已经完成了

sudo systemctl daemon-reload
sudo systemctl restart docker

寻求具体帮助。

我已经浏览了大部分有关 TLS 握手超时问题的帖子,但没有得到任何对我有用的答案或建议。 我的代理很好,docker 正在使用它。我不明白为什么它会出现令人讨厌的超时。

docker ssl proxy docker-registry docker-pull
6个回答
20
投票

配置文件是:

[Service]
Environment=“HTTP_PROXY=http://pqr.corp.xxx.com:8080”
Environment=“HTTPS_PROXY=https://pqr.corp.xxx.com:8080”
Environment=“NO_PROXY=localhost,127.0.0.1”

注意第三行:HTTPS_PROXY=https

代理服务器支持HTTPS吗?或者应该有错误。

也许

HTTPS_PROXY=http
是正确的。

顺便说一下,类似的错误是

Get https://registry-1.docker.io/v2/: proxyconnect tcp: EOF


5
投票

我之前的答案都指向这个方向,但都没有明确说明:删除所有https代理设置可以解决这个问题。我有一个

https-proxy.conf
文件,就像OP的一样,
docker pull
在我删除
HTTPS_PROXY后开始工作
线。我知道我使用的 https 代理工作正常,所以这一定是 Docker 方面的问题。

我在服务器故障上找到了这个解决方案


4
投票
原因通常与您的网络设置有关。特别是,如果您的 Docker 设置了代理,请使用“无代理”选项将其临时设置,它应该可以工作。

干杯


4
投票
我在防火墙后面也遇到了同样的问题。请按照以下步骤操作:

$ sudo vim /etc/systemd/system/docker.service.d/http_proxy.conf [Service] Environment=“HTTP_PROXY=http://username:password@IP:port/”

请勿使用或删除 https_prxoy.conf 文件。

重新加载并重新启动你的docker

$ sudo systemctl daemon-reload $ sudo systemctl restart docker $ docker pull hello-world Using default tag: latest latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:2557*********************************8 Status: Downloaded newer image for hello-world:latest
    

0
投票
在 Ubuntu 22-04 (WSL 2) 上,我刚刚撤消了文件中

export http_proxy

 字段的注释 
/etc/default/docker

    


0
投票
我在 MacOS 上使用 Docker Desktop 时遇到了这个问题。通过添加解决了

"debug": true
进入 Docker 引擎的配置(选项卡设置 > Docker 引擎)
祝你好运

© www.soinside.com 2019 - 2024. All rights reserved.