我刚刚在他们的网页上安装了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或重新创建映像都没有帮助。我重启了Windows,但没有用。

令人惊讶的是,当我ssh进入运行的容器并curl https://index.docker.io/v1/repositories/library/hello-world/images时,我得到了一个完全有效的响应。

我在64bit Windows 10 Pro上使用了Docker Toolbox和VirtualBox。

我的解决方案是卸载旧版本的Docker,并安装使用Hyper-V而不是VirtualBox的新版本。

现在Docker又可以工作了。

其他回答

更简单的解决方案是在/etc/default/docker文件中添加以下条目

出口http_proxy = " http://HOST "

并重新启动docker服务

服务docker重启

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

在Windows系统上,当我从工作网络转移到家庭网络时,就发生了这种情况。

要解决这个问题,运行:

docker-machine停止 docker-machine开始 docker-env "C:\Program Files\Docker Toolbox\ Docker -machine.exe" env |调用表达式

为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/"

希望能有所帮助

如果你在代理之后,它是不够的,设置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