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

我从Docker快速入门终端开始,如下所示

                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ 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$ 

但当我尝试执行docker拉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$ 

怎么了?


当前回答

为docker服务创建systemd下拉目录:

$ sudo mkdir -p /etc/systemd/system/docker.service.d

创建一个名为/etc/systemd/system/docker.service.d/http-proxy.conf的文件,添加HTTP_PROXY环境变量:

(服务)

Environment="HTTP_PROXY=http://proxy.example.com:80/"

希望能有所帮助

其他回答

另一种情况:如果您的docker网络适配器是禁用的,它将失败与此错误。适配器被命名为“vEthernet (DockerNAT)”或类似的名称。显然,这个适配器以某种方式参与了正常的docker pull行为。让它回来解决问题。

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`

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

欲了解更多信息,请参阅这一期(日期),它提供了这里给出的答案。

我今天在使用1.10.1时遇到了这个问题,现有的解决方案都不起作用。我试着重新启动,升级,重新生成证书…

我注意到我在机器上创建了很多网络。去除后用:

docker network ls | grep bridge | awk '{print $1}' | xargs -n1 docker network rm

DNS又开始工作了。

注意:您可以忽略有关预定义网络的错误

为docker服务创建systemd下拉目录:

$ sudo mkdir -p /etc/systemd/system/docker.service.d

创建一个名为/etc/systemd/system/docker.service.d/http-proxy.conf的文件,添加HTTP_PROXY环境变量:

(服务)

Environment="HTTP_PROXY=http://proxy.example.com:80/"

希望能有所帮助

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