Search code examples
osx-mavericksdockerboot2docker

Docker can't connect to boot2docker because of TCP timeout


I'm running Mac OS 10.9.5 (Mavericks), I've followed https://docs.docker.com/installation/mac/ to install Docker. I get a timeout error message when I run Docker even though the boot2docker VM is running in the background.

nikhil@macbook ~> boot2docker status
running
nikhil@macbook ~> boot2docker ip

The VM's Host only interface IP address is: 192.168.59.103

nikhil@macbook ~> docker run hello-world
2014/11/01 01:01:31 Post https://192.168.59.103:2376/v1.15/containers/create: dial tcp 192.168.59.103:2376: i/o timeout
nikhil@macbook ~> docker search ubuntu
2014/11/01 01:02:40 Get https://192.168.59.103:2376/v1.15/images/search?term=ubuntu: dial tcp 192.168.59.103:2376: i/o timeout

I have verified that Docker is running inside the boot2docker VM and that my port is correct.

nikhil@macbook ~> boot2docker ssh
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.3.1, build master : 9a31a68 - Fri Oct 31 03:14:34 UTC 2014
Docker version 1.3.1, build 4e9bbfa
docker@boot2docker:~$ sudo netstat -ntpl | grep docker
tcp        0      0 :::2376                 :::*                    LISTEN      629/docker

Solution

  • I have had this issue as well and here is a temporary solution.

    First, open VirtualBox and check the network settings on the boot2docker VM to see what the host only adapter is named. In my case, it's vboxnet1; for you, it may be vboxnet0.

    Then, apply this command:

    sudo route -nv add -net 192.168.59 -interface vboxnet1
    

    Now you should be able to run Docker commands.

    See this issue for more information.

    I am noticing over time that a common denominator in this problem is Cisco anyconnect (me included), for what it's worth.