您的位置:首页 > 运维架构 > Docker

docker问题:Network timed out while trying to connect

2016-03-12 10:36 726 查看
cs202@cs202-devbox:~$ sudo docker run -i -t ubuntu /bin/bash

[sudo] password for cs202:

Unable to find image 'ubuntu:latest' locally

Pulling repository docker.io/library/ubuntu

Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/ubuntu/images. You may want to check your internet connection or if you are behind a proxy.

cs202@cs202-devbox:~$ wget https://index.docker.io/v1/repositories/library/ubuntu/images
--2016-03-11 21:16:29-- https://index.docker.io/v1/repositories/library/ubuntu/images
Resolving index.docker.io (index.docker.io)... 52.0.10.162, 54.152.78.181, 54.164.250.255

Connecting to index.docker.io (index.docker.io)|52.0.10.162|:443... failed: Connection timed out.

Connecting to index.docker.io (index.docker.io)|54.152.78.181|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: unspecified [application/json]

Saving to: ‘images’

[ <=> ] 79,813 153KB/s in 0.5s

2016-03-11 21:18:38 (153 KB/s) - ‘images’ saved [79813]

stackoverflow上面有人碰到类似的问题,有人说用下面这种方式可以解决:

I had the same problem this morning and the following fixed it for me:

$ docker-machine restart default # Restart the environment

$ eval $(docker-machine env default) # Refresh your environment se

ttings

It appears that this is due to the Docker virtual machine getting itself into a strange state. There is an open github issue here: https://github.com/docker/docker/issues/20910
这是github上的issue的回复:

Yes, this is a known issue with VirtualBox; after a while (and when switching networks, e.g. when you're connected to a different WiFi network), networking inside VirtualBox stops working correctly. The latest version of Docker Machine should have some improvements,
but restarting the virtual machine sometimes is the only option.

See the discussion on docker/machine#1857.

I'm going to close this issue here, because this is an issue with VirtualBox or Docker Machine / Toolbox, so unfortunately we cannot fix that in this repository. Feel free to comment here after I've closed

但是我什么都没干,只是重试了以下,发现居然也好了:

cs202@cs202-devbox:~$ sudo docker run -i -t ubuntu /bin/bash

Unable to find image 'ubuntu:latest' locally

latest: Pulling from library/ubuntu

073de23ee32b: Pulling fs layer

9d89fd8f8a3e: Pulling fs layer

0b427fcc4cbb: Pulling fs layer

8ed581e3fa7a: Pulling fs layer

Pulling repository docker.io/library/ubuntu

56063ad57855: Pulling dependent layers

454970bd163b: Downloading 8.105 MB

---成功了:

cs202@cs202-devbox:~$ sudo docker run -i -t ubuntu /bin/bash

Unable to find image 'ubuntu:latest' locally

latest: Pulling from library/ubuntu

073de23ee32b: Pulling fs layer

9d89fd8f8a3e: Pulling fs layer

0b427fcc4cbb: Pulling fs layer

8ed581e3fa7a: Pulling fs layer

Pulling repository docker.io/library/ubuntu

56063ad57855: Download complete

454970bd163b: Download complete

38112156678d: Download complete

4e1f7c524148: Download complete

Status: Downloaded newer image for ubuntu:latest

docker.io/library/ubuntu: this image was pulled from a legacy registry. Important: This registry version will not be supported in future versions of docker.

root@257646e19a08:/#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: