【问题标题】:Docker pull failed with request canceled while waiting for connectionDocker pull 在等待连接时因请求取消而失败
【发布时间】:2017-04-19 09:08:18
【问题描述】:

我正在尝试将图像拉到默认的 docker 机器。但我总是得到

docker@default:/etc$ docker run hellow-world
Unable to find image 'hellow-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.
docker@default:/etc$

即使我给 --dns 选项同样的错误

docker@default:/etc$ docker run hellow-world --dns=8.8.8.8
Unable to find image 'hellow-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.
docker@default:/etc$

尝试将DNS添加到默认机器的config.json

"EngineOptions": {
    "Dns": [
        "8.8.8.8",
        "8.8.4.4"
    ]
}

resolv.conf 在默认机器中有以下条目

docker@default:/etc$
docker@default:/etc$ cat /etc/resolv.conf
search <company name>
nameserver 10.0.2.3
docker@default:/etc$

这台机器位于代理后面,我正在使用 kitematic 来创建默认机器

Kitematic 由自定义脚本启动,该脚本将设置代理并启动 kitematic

推荐和所有图像显示在风筝开始时。但不能拉任何图像

创建新机器也会发出警告

PS C:\Program Files\Docker Toolbox\kitematic> docker-machine create -d virtualbox --engine-opt dns=8.8.8.8 test
Running pre-create checks...
(test) Unable to get the latest Boot2Docker ISO release version:  Get https://api.github.com/repos/boot2docker/boot2docker/releases/latest: dial tcp 192.30.253.116:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Creating machine...
(test) Unable to get the latest Boot2Docker ISO release version:  Get https://api.github.com/repos/boot2docker/boot2docker/releases/latest: dial tcp 192.30.253.116:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

使用--dns 选项创建的机器也有/etc/resolv.conf 而不是8.8.8.8

docker@test:~$
docker@test:~$ cat /etc/resolv.conf
search <company name>
nameserver 10.0.2.3
docker@test:~$

PS:将 HTTP_PROXY 添加到 /var/lib/boot2docker/profile 后问题解决

【问题讨论】:

    标签: docker boot2docker docker-machine


    【解决方案1】:

    找到解决办法

    要么 将HTTP_PROXY 添加到/var/lib/boot2docker/profile

    --engine-env HTTP_PROXY=IP:PORT创建docker机器

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-12-25
      • 2018-07-25
      • 1970-01-01
      • 2021-07-03
      • 2018-07-21
      • 2018-09-21
      • 1970-01-01
      相关资源
      最近更新 更多