2017-04-19 91 views
1

我正在尝试将图像拉到默认的泊坞窗机器上。但是,我总是得到在等待连接时取消请求的Docker拉失败

[email protected]:/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'. 
[email protected]:/etc$ 

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

[email protected]:/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'. 
[email protected]:/etc$ 

尝试添加DNS到默认机器

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

的resolv.conf有config.json以下输入默认机器

[email protected]:/etc$ 
[email protected]:/etc$ cat /etc/resolv.conf 
search <company name> 
nameserver 10.0.2.3 
[email protected]:/etc$ 

本机坐在代理之后,我使用kitematic创建默认机器

Kitematic通过自定义脚本将设置代理,并开始启动kitematic

推荐和所有图像都在kitematic开始显示。但不能拉任何图像

创建新机也给予警告与--dns选项创建

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. 

该机还拥有/etc/resolv.conf没有8.8.8.8

[email protected]:~$ 
[email protected]:~$ cat /etc/resolv.conf 
search <company name> 
nameserver 10.0.2.3 
[email protected]:~$ 

PS:发行后添加HTTP_PROXY解决了/ var/lib/boot2docker/profile

回答

2

找到的解决方案

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

创建泊坞窗机--engine-env HTTP_PROXY=IP:PORT