Network timed out while trying to connect to https

2019-03-07 09:29发布

I installed Docker-Toolbox just now while following their webpage

I started with Docker QuickStart Terminal and see following

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

But when I try to perform docker pull hello-world, this is what I see

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$ 

What's wrong?

19条回答
趁早两清
2楼-- · 2019-03-07 10:12

I assume that you have a network problem. Are you behind a proxy? Is it possible that it filters the connection to docker.io or blocks the docker user agent?

I installed the toolbox and ran your test. It works fine, here:

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$
查看更多
Animai°情兽
3楼-- · 2019-03-07 10:12

On Windows this happened when I moved from a work network to a home network.

To solve it, run:

  1. docker-machine stop
  2. docker-machine start
  3. docker-env
  4. "C:\Program Files\Docker Toolbox\docker-machine.exe" env | Invoke-Expression
查看更多
地球回转人心会变
4楼-- · 2019-03-07 10:13

In my case, installing docker on Alpine Linux I get the error:

Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/........

Using the script here: https://github.com/docker/docker/blob/master/contrib/download-frozen-image-v2.sh

Works. It downloads the image using curl and then shows you how to untar and 'docker load' it.

I tried the above methods of static DNS at 8.8.8.8 and disabling ipv6 (I didn't understand the proxy thing) and none of them worked for me.

EDIT 9/8/2016:

I was initially using dropbear instead of openssh. Reinstalled Alpine with openssh fixed the problem.

The next problem was 'ApplyLayer exit status 1 stdout: stderr: chmod /bin/mount: permission denied' error during pull.

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

To build the Docker image, I had to disable the following grsec protections. Modify the /etc/sysctl.d/grsec.conf as follows:

kernel.grsecurity.chroot_deny_chmod = 0 kernel.grsecurity.chroot_deny_mknod = 0 kernel.grsecurity.chroot_caps = 0 # related to a systemd package/CAP_SETFCAP

in alpine's case though it's

/etc/sysctl.d/00-alpine.conf

reboot

查看更多
Evening l夕情丶
5楼-- · 2019-03-07 10:14
sudo service docker stop
sudo service docker start

works for me..

somehow, sudo service docker restart didn't work

(RHEL7)

查看更多
Viruses.
6楼-- · 2019-03-07 10:14

Create a systemd drop-in directory for the docker service:

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

Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:

[Service]

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

Hope it helps

查看更多
ゆ 、 Hurt°
7楼-- · 2019-03-07 10:16

If you are behind proxy kindly use below commands

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

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

sudo vi http-proxy.conf
[Service]

Environment=HTTP_PROXY=http://proxy-server-ip:port" "NO_PROXY=localhost,127.0.0.1"

sudo systemctl daemon-reload 

sudo systemctl show --property=Environment docker

sudo systemctl restart docker

Try this if you can fetch latest ubuntu

sudo docker run -it ubuntu bash

Unable to find image ubuntu:latest locally

latest: Pulling from library/ubuntu b3e1c725a85f: Pull complete

4daad8bdde31: Pull complete

63fe8c0068a8: Pull complete

4a70713c436f: Pull complete

bd842a2105a8: Pull complete

Digest:

sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a

Status: Downloaded newer image for ubuntu:latest

It worked for me finally :)

查看更多
登录 后发表回答