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

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

查看更多
趁早两清
3楼-- · 2019-03-07 10:04

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
查看更多
唯我独甜
4楼-- · 2019-03-07 10:06

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

查看更多
姐就是有狂的资本
5楼-- · 2019-03-07 10:08

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

boot2docker restart
查看更多
叛逆
6楼-- · 2019-03-07 10:10

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

查看更多
劳资没心,怎么记你
7楼-- · 2019-03-07 10:12

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

查看更多
登录 后发表回答