docker问题:Network timed out while trying to connect

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:/# 
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值