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

我今天早上遇到了同样的问题,下面的问题为我解决了:

$ docker-machine restart default      # Restart the environment
$ eval $(docker-machine env default)  # Refresh your environment settings

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


我有同样的问题与boot2docker和修复它重新启动它:

boot2docker restart

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


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

出口http_proxy = " http://HOST "

并重新启动docker服务

服务docker重启


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

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

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

DNS又开始工作了。

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


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


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


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

要解决这个问题,运行:

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


我在Windows 10上安装的Docker没有工具箱,所以需要启用Hyper-V的版本。

对于Docker 1.12版本,我必须进入任务栏,右键单击Docker图标,选择设置->网络,并将DNS服务器设置为固定,即使用谷歌的DNS服务器8.8.8.8。

一旦这个设置被改变,它终于起作用了。


我昨天遇到了这个完全相同的问题,没有一个“流行”的答案(比如将DNS修复到8.8.8.8)对我有效。我最终偶然发现了这个链接,这就成功了……https://github.com/docker/for-win/issues/16

在Docker for Windows, Windows 10和Hyper-V之间,在虚拟网络适配器创建过程中似乎有一个问题。具体来说,您可能最终会得到两个“vEthernet (DockerNAT)”网络适配器。使用Get-NetAdapter“vEthernet (DockerNAT)”检查(在一个升高的PowerShell控制台)。如果结果显示了多个适配器,您可以禁用并重命名它:

$vmNetAdapter = Get-VMNetworkAdapter -ManagementOS -SwitchName DockerNAT
Get-NetAdapter "vEthernet (DockerNAT)" | ? { $_.DeviceID -ne $vmNetAdapter.DeviceID } | Disable-NetAdapter -Confirm:$False -PassThru | Rename-NetAdapter -NewName "OLD"

然后打开Device Manager并删除禁用的适配器(出于某种原因,可以从这里执行,但不能从Network and Sharing Center适配器视图执行)。


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

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


在我的情况下,安装docker在Alpine Linux我得到的错误:

试图连接到https://index.docker.io/v1/repositories/library/........时,网络超时

使用脚本: https://github.com/docker/docker/blob/master/contrib/download-frozen-image-v2.sh

的工作原理。它使用curl下载图像,然后告诉你如何解tar和“docker加载”它。

我在8.8.8.8尝试了上面的静态DNS方法和禁用ipv6(我不理解代理的事情),没有一个对我有用。

编辑9/8/2016:

我最初使用dropbear而不是openssh。用openssh重新安装Alpine修复了这个问题。

下一个问题是“ApplyLayer退出状态1 stdout: stderr: chmod /bin/mount: permission denied”错误。

从(nixaid.com/grsec-in-docker/):

为了构建Docker映像,我必须禁用以下grsec 保护。修改“/etc/sysctl.d/grsec.conf”文件如下: kernel.grsecurity。Chroot_deny_chmod = 0 kernel.grsecurity。Chroot_deny_mknod = 0 kernel.grsecurity。chroot_caps = 0 #与systemd包/CAP_SETFCAP相关

但在alpine的案例中

/ etc / sysctl。d / 00-alpine上。

重新启动


重新启动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又可以工作了。


在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


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

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映像:最新

它终于为我工作了:)


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


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

希望能有所帮助


参考https://docs.docker.com/network/proxy/ 对我来说,没有http://或https://前缀的代理设置是有效的。 例句: 代理:港口

或以/为后缀,以http://或https://为前缀 e。: http://PROXY:PORT/