我刚刚在他们的网页上安装了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$ 

怎么了?


当前回答

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

其他回答

sudo service docker stop
sudo service docker start

对我有用。

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

(RHEL7)

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

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

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

要解决这个问题,运行:

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

如果您落后于代理,请使用以下命令

sudo mkdir /etc/systemd/system/docker.service.d

sudo cd /etc/systemd/system/docker.service.d

sudo vi http-proxy.conf

(服务) 环境= HTTP_PROXY = http://proxy-server-ip:端口”“NO_PROXY = localhost, 127.0.0.1” Sudo systemctl daemon-reload sudo systemctl show——property=环境docker Sudo systemctl restart docker

如果你能获取最新的ubuntu,试试这个

sudo docker run -it ubuntu bash

无法在本地找到映像ubuntu:latest

Pull from library/ubuntu b3e1c725a85f: Pull complete 4daad8bdde31:拉完成 63fe8c0068a8:拉完成 4a70713c436f:拉完成 bd842a2105a8:拉取完成 摘要: sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a 状态:下载更新的ubuntu映像:最新

它终于为我工作了:)

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

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

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

DNS又开始工作了。

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