docker问题:Network timed out while trying to connect

原创 2016年03月12日 10:36:12
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:/# 

解决Docker pull image时Network timed out的问题(多数因为网络被墙)

当执行 #docker pull {$image_name} 时,pull不下来,错误为: Network timed out while trying to connect to https:...

理解Docker容器网络之Linux Network Namespace

由于2016年年中调换工作的原因,对容器网络的研究中断过一段时间。随着当前项目对Kubernetes应用的深入,我感觉之前对于容器网络的粗浅理解 已经不够了,容器网络成了摆在前面的“一道坎”。继...

Docker-Toolbox常见问题解决方案

Docker Toolbox常见错误的通用解决方案

如何给docker设置http代理

公司网络使用代理服务器上外网。在ubuntu上用docker pull出现 sudo docker pull busybox Using default tag: latest Pulling rep...

Docker 使用国内加速器

使用国内源对docker image拉取进行加速的方法。 CentOS7中会有一个坑,在此指出。...

docker同步镜像报错Network timed out while trying to connect

docker 1.9.1 docker在同步镜像的时候,默认从国外镜像源下载,经常会出现网络错误,国内阿里云提供了docker镜像加速器,可以用来加快下载速度。登录阿里云后,选择docker镜像仓库...

Docker 疑难&workaround 汇总

部署docker集群过程中,遇到不少坑。

使用阿里云专属加速器加快获取Docker官方镜像的实战

本文档介绍如何使用阿里云专属加速器加快获取Docker官方镜像。步骤如下:1.      首先需要有阿里云账号,没有就注册阿里云开发账号:https://dev.aliyun.com/ 2.     ...

解决Docker pull image时Network timed out的问题(多数因为网络被墙)

当执行 #docker pull {$image_name} 时,pull不下来,错误为: Network timed out while trying to connect to https:...

Docker 使用国内加速器

使用国内源对docker image拉取进行加速的方法。 CentOS7中会有一个坑,在此指出。...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:docker问题:Network timed out while trying to connect
举报原因:
原因补充:

(最多只允许输入30个字)