获取 https://registry-1.docker.io/v2/: net/http: 请求在等待连接时被取消(Client.Timeout exceeded while awaiting headers)

Ben*_*Ben 7 docker docker-image docker-build

尝试构建 docker 映像时出现以下错误。我的操作系统是企业环境中的 CentOS 7。

Sending build context to Docker daemon  1.22GB
Step 1/20 : FROM centos
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
Run Code Online (Sandbox Code Playgroud)

我遵循了我在网上得到的答案。(相关问题)。我以 24 票的方式跟随答案,因为它是为 CentOS 7 提供的

我在目录 /etc/sysconfig/ 中创建了一个名为 docker 的文件并添加了以下内容

HTTP_PROXY="http://proxy.example.com:80/"
HTTPS_PROXY="https://proxy.example.com:443/"
http_proxy="${HTTP_PROXY}"
https_proxy="${HTTPS_PROXY}"
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误。

Sending build context to Docker daemon  1.22GB
Step 1/20 : FROM centos
Get https://registry-1.docker.io/v2/: http: error connecting to proxy https://proxy.example.com:443/: dial tcp: lookup proxy.example.com on 127.0.0.1:53: no such host
Run Code Online (Sandbox Code Playgroud)

我的 Docker 版本是

client : 
version 17.05.0-ce
API version:  1.29
server :
version :17.05.0-ce
API version:  1.29
Run Code Online (Sandbox Code Playgroud)