尝试连接到https://index.docker.io时,网络超时

day*_*mer 203 docker docker-machine docker-toolbox

我刚刚在他们的网页上安装了Docker-Toolbox

我开始Docker QuickStart Terminal并看到以下

                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/


docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com

bash-3.2$ 
Run Code Online (Sandbox Code Playgroud)

但是当我尝试表演时docker pull hello-world,这就是我所看到的

bash-3.2$ docker run hello-world
Unable to find image 'hello-world:latest' locally
Pulling repository docker.io/library/hello-world
Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/hello-world/images. You may want to check your internet connection or if you are behind a proxy.
bash-3.2$ 
Run Code Online (Sandbox Code Playgroud)

怎么了?

小智 481

今天早上我遇到了同样的问题,以下内容为我解决了这个问题:

$ docker-machine restart default      # Restart the environment
$ eval $(docker-machine env default)  # Refresh your environment settings
Run Code Online (Sandbox Code Playgroud)

看来这是由于Docker虚拟机陷入了一种奇怪的状态.这里有一个开放的github问题

  • 当我从工作局域网切换到家庭局域网时似乎发生了.也许DNS无法在家中访问. (17认同)
  • 当我改变WiFi网络时,我可以确认它中断了.重启Docker总是修复它. (10认同)
  • 这也为我修好了......但是,我必须在每次新的终端会话中重新运行它. (3认同)
  • 完美,在我的情况下,我必须包括`docker-machine regenerate-certs default`. (3认同)
  • 神圣的废话,它现在都有意义.切换网络设置(wifi,到局域网,到VPN,家庭网络,工作内联网,iphone,......)会导致这些奇怪的问题. (3认同)

Mas*_*len 41

我在Windows 10上安装了没有Toolbox的Docker,因此需要启用Hyper-V的版本.

对于Docker版本1.12,我必须进入任务栏,右键单击Docker图标,选择设置 - >网络并将DNS服务器设置为固定,这样就可以使用Google的DNS服务器了8.8.8.8.

一旦这个设置改变了,它终于奏效了.


pr-*_*pal 16

更简单的解决方案是在/ etc/default/docker文件中添加以下条目

export http_proxy ="http:// HOST:PORT /"

并重新启动docker服务

服务码头重启

  • 对于centos,它位于/ etc/sysconfig/docker文件中. (2认同)

arc*_*don 8

2016年8月更新

使用Docker for Mac(版本1.12.0),看到了表单的问题:

?  docker pull node
Using default tag: latest
Pulling repository docker.io/library/node
Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/node/images. You may want to check your internet connection or if you are behind a proxy.`enter code here`
Run Code Online (Sandbox Code Playgroud)

通过更新我的MacBook Pro无线网络设置以包含以下DNS条目来解决此问题: 8.8.8.8

有关详细信息,请参阅此(日期)问题,该问题提供了此处给出的答案.


小智 7

我在VBOX 5.10中使用Docker VM在我的MAC(主机)上运行Docker遇到了这个问题.这是一个网络问题.简单的解决方法是将桥接网络添加到VBOX映像.您可以使用随VM提供的NAT配置,但需要将ssh端口从50375更改为2375.