我刚刚在他们的网页上安装了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-machine restart default      # Restart the environment
$ eval $(docker-machine env default)  # Refresh your environment settings

这似乎是由于Docker虚拟机进入了一个奇怪的状态。这里有一个开放的github问题

其他回答

在Windows 10上。只需右键单击systray docker图标-> Settings…-> Rest ->重启Docker

sudo service docker stop
sudo service docker start

对我有用。

不知何故,sudo服务docker重启没有工作

(RHEL7)

在Windows 7上,如果你认为你落后于代理

Logon to default machine $ docker-machine ssh default Update profile to update proxy settings docker@default:~$ sudo vi /var/lib/boot2docker/profile Append from the below as appropriate # replace with your office's proxy environment export"HTTP_PROXY=http://PROXY:PORT" export"HTTPS_PROXY=http://PROXY:PORT" # you can add more no_proxy with your environment. export"NO_PROXY=192.168.99.*,*.local,169.254/16,*.example.com,192.168.59.*" Exit docker@default:~$ exit Restart docker machine docker-machine restart default Update environment settings eval $(docker-machine env default)

以上步骤略有调整,但请参见故障排除指南:https://docs.docker.com/toolbox/faqs/troubleshoot/#/update-varlibboot2dockerprofile-on-the-docker-machine

如果你在代理之后,它是不够的,设置HTTP_PROXY和HTTPS_PROXY env。您应该在创建机器时设置它。

参数为——engine-env:

docker-machine create -d "virtualbox" --engine-env HTTP_PROXY=http://<PROXY>:<PORT> --engine-env HTTPS_PROXY=<PROXY>:<PORT> dev

我猜您有网络问题。你背后有代理人吗?它是否有可能过滤到docker的连接。IO或阻塞docker用户代理?

我安装了工具箱,运行了你的测试。它工作得很好,在这里:

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

bash-3.2$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world

535020c3e8ad: Pull complete 
af340544ed62: Already exists 
library/hello-world:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
Digest: sha256:d5fbd996e6562438f7ea5389d7da867fe58e04d581810e230df4cc073271ea52
Status: Downloaded newer image for hello-world:latest

Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/userguide/

bash-3.2$