204

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?

0x7d7b
  • 41,374
  • 7
  • 39
  • 55
daydreamer
  • 73,989
  • 165
  • 410
  • 667

19 Answers19

481

I had the same problem this morning and the following fixed it for me:

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

It appears that this is due to the Docker virtual machine getting itself into a strange state. There is an open github issue here

Emzor
  • 1,320
  • 16
  • 27
Mark Smith
  • 4,826
  • 1
  • 7
  • 2
  • 3
    This also fixed it for me... however, I have to rerun it with every new terminal session. – THX1137 Oct 16 '15 at 13:28
  • 17
    Seems to happen when I switch from my work LAN to home LAN. Maybe the DNS is unreachable from home. – taco Oct 29 '15 at 00:17
  • 10
    I can confirm it breaks when I change WiFi networks. Restarting Docker always fixes it. – Stephen Harrison Nov 28 '15 at 18:19
  • 3
    Perfect, in my case I had to include `docker-machine regenerate-certs default`. – rogeriopradoj Dec 03 '15 at 13:18
  • I think this "strange state" is when the datetime on the VirtualBox guest machine gets out of sync with the host. At least on OS X. – OneCricketeer Jan 14 '16 at 16:05
  • When tried to do `docker-machine restart default` on Mac OS X (10.10.5) I got the following error: `...VBoxManage: error: The object is not ready VBoxManage: error: Details: code E_ACCESSDENIED (0x80070005)...` but running `sudo docker-machine restart default` helped – zjor Jan 23 '16 at 09:00
  • 3
    holy crap, it makes all sense now. Switching network settings (wifi, to lan, to vpn, home-network, work intranet, iphone, ... ) causes these strange issues. – nils petersohn Feb 27 '16 at 16:03
  • This happens when I switch from my corp network to my home network, so I imagine it's a problem with the VM's DNS resolver. – taco May 03 '16 at 15:03
  • 1
    This didn't work for me on Mac, as it said something like "there's no host 'default'". However, it started working after doing what @arcseldon said: adding 8.8.8.8 as a DNS entry. – Renato Back Aug 23 '16 at 12:48
  • I have just reset my docker because the virtual drive was too large (60gb). And then I got the network issue on pull ubuntu. I get a <> message on the first command from this answer. The second then contains a lot of red. I guess the first one must run successfully first. – Radu Simionescu Oct 11 '16 at 19:04
  • This worked for me. The MINGW64 terminal was left open overnight and this command fixed the network connection issue. – Nathan Yeung Nov 29 '16 at 19:05
41

I installed Docker without the Toolbox on Windows 10, so the version that requires Hyper-V to be enabled.

For Docker version 1.12 I had to go into the taskbar, right click the Docker Icon, select Settings -> Network and set the DNS Server to fixed, so that is uses Google's DNS server at 8.8.8.8.

Once that setting was changed, it finally worked.

Mastergalen
  • 3,979
  • 3
  • 24
  • 34
  • I just switched to fixed and then switched it back and hit apply. Didn't need to leave it on fixed. – Philip Tinney Aug 05 '16 at 01:19
  • In my case I have the OpenDNS umbrella client installed which sets your network settings to use 127.0.0.1 for DNS. Docker seems to copy the settings from your network card, so was putting localhost into it's own DNS settings which naturally won't work. – Richard Benson Sep 14 '16 at 13:38
  • Worked on windows 10 – master Jun 02 '19 at 12:55
16

The simpler solution is to add the following entry in /etc/default/docker file

export http_proxy="http://HOST:PORT/"

and restart the docker service

service docker restart

pr-pal
  • 1,794
  • 15
  • 11
8

Update August 2016

Using Docker for Mac (version 1.12.0), was seeing issues of the form:

➜  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`

This was resolved by updating my MacBook Pro wireless network settings to include the following DNS entry: 8.8.8.8

For further info, please see this (dated) issue which provided the answer given here.

arcseldon
  • 29,753
  • 14
  • 104
  • 117
7

I ran into this problem running Docker on my MAC(host) with Docker VM in VBOX 5.10. It is a networking issue. The simple fix is to add a bridged network to the VBOX image. You can use the included NAT config present with the VM, but you need to change the ssh port from 50375 to 2375.

dbaOnTap
  • 186
  • 1
  • 6
  • 1
    This is what worked for me (VirtualBox 5.0.10r104061 on Windows 10 Pro). Note to newbies newer than me that you'll have to `docker-machine stop default`, then add the network in the VirtualBox manager, then `docker-machine start default` (changing default to your machine's name as necessary). I had tried @Mark-Smith's simple restart+eval env suggestion first and that didn't do it for me. – David Brown Jan 07 '16 at 00:09
  • @dbaOnTap You are a godsend my friend. I've been stuck on this for days. Running Windows 10 Home with VirtualBox Latest Test Build (5.0.15-10594) and latest docker toolbox (1.10.0), this is the only thing that worked for me. – kutacoder Feb 09 '16 at 22:19
4
sudo service docker stop
sudo service docker start

works for me..

somehow, sudo service docker restart didn't work

(RHEL7)

ItayB
  • 6,914
  • 7
  • 41
  • 59
4

On Windows 7 and if you believe you are behind proxy

  1. Logon to default machine

    $ docker-machine ssh default
    
  2. Update profile to update proxy settings

    docker@default:~$ sudo vi /var/lib/boot2docker/profile
    
  3. 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.*"
    
  4. Exit

    docker@default:~$ exit
    
  5. Restart docker machine

    docker-machine restart default
    
  6. Update environment settings

    eval $(docker-machine env default)
    

Above steps are slightly tweaked but as given in troubleshooting guide: https://docs.docker.com/toolbox/faqs/troubleshoot/#/update-varlibboot2dockerprofile-on-the-docker-machine

Vidish Datta
  • 182
  • 8
  • In my case, works, but I removed `export"HTTP_PROXY=http://PROXY:PORT` and ` ... HTTPS_PROXY... ` because the net is accessed directly without auth. – Muka Mar 07 '19 at 18:28
2

I ran into this exact same problem yesterday and none of the "popular" answers (like fixing DNS to 8.8.8.8) worked for me. I eventually happened across this link, and that did the trick ... https://github.com/docker/for-win/issues/16

Between Docker for Windows, Windows 10 and Hyper-V, there seems to be a problem during the virtual network adapter creation process. Specifically, you might end up with two "vEthernet (DockerNAT)" network adapters. Check this with Get-NetAdapter "vEthernet (DockerNAT)" (in an elevated PowerShell console). If the result shows more than one adapter, you can disable and rename it with:

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

Then open up Device Manager and delete the disabled adapter (for some reason you can do this from here, but not from the Network and Sharing Center adapters view).

Peter-John
  • 71
  • 7
1

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$
0x7d7b
  • 41,374
  • 7
  • 39
  • 55
1

On Windows 10. Just right-click on the systray docker icon-> Settings... -> Rest -> Restrart Docker

argenisleon
  • 310
  • 1
  • 5
  • 9
0

I had this same problem with boot2docker and fixed it by restarting it with:

boot2docker restart
sigget
  • 837
  • 5
  • 14
0

I just ran into this today with 1.10.1 and none of the existing solutions worked. I tried to restart, upgrade, regenerate certs, ...

I noticed that I had a lot of networks created on the machine. After removing them with:

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

The DNS started working again.

Note: You may ignore errors about pre-defined networks

schmunk
  • 4,607
  • 1
  • 25
  • 48
0

If you are behind proxy it is not enough to set HTTP_PROXY and HTTPS_PROXY env. You should set it while machine creation.

Paramer for this is --engine-env:

docker-machine create -d "virtualbox" --engine-env HTTP_PROXY=http://<PROXY>:<PORT> --engine-env HTTPS_PROXY=<PROXY>:<PORT> dev
Walery Strauch
  • 5,317
  • 7
  • 45
  • 53
0

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

5k3105
  • 11
  • 2
  • I realise it isn't the case here, but for the future: disabling IPv6 is never a correct answer. If disabling IPv6 ever "fixes" a problem, the real problem lies elsewhere. – Stephen Sep 02 '16 at 22:19
0

Restarting Docker or recreating the image did not help. I rebooted Windows to no avail.

Astoundingly, when I ssh'ed into the running container and did curl https://index.docker.io/v1/repositories/library/hello-world/images I got a perfectly valid response.

I used the Docker Toolbox with VirtualBox on 64bit Windows 10 Pro.

The solution in my case was to uninstall the old Docker version and install the new one that uses Hyper-V instead of VirtualBox.

Now Docker works again.

Matthias Braun
  • 24,493
  • 16
  • 114
  • 144
0

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 :)

Cà phê đen
  • 1,815
  • 2
  • 17
  • 18
0

Another scenario: if your docker network adapter is disabled, it will fail with this error. The adapter is named "vEthernet (DockerNAT)" or similar. Apparently this adapter is involved somehow in the normal docker pull behavior. Enable it back to solve the problem.

Yonatan
  • 1,018
  • 14
  • 28
0

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

YanetP1988
  • 1,214
  • 2
  • 17
  • 32
-1

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
Tim Malone
  • 2,894
  • 4
  • 31
  • 44