Docker cannot connect to boot2docker due to tcp timeout

I am running Mac OS 10.9.5, I followed https://docs.docker.com/installation/mac/ to install docker. I get a timeout error message when I launch dockers, even though the boot2docker virtual machine is running in the background.

nikhil@macbook ~> boot2docker status running nikhil@macbook ~> boot2docker ip The VM 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 checked that docker is running inside 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 
+63
docker boot2docker osx-mavericks
Nov 01 '14 at 5:07
source share
12 answers

I also had this problem and this is a temporary solution.

First, open the virtual box and check the network settings on boot2docker vm to find out what the host only adapter name is. In my case, it is vboxnet1; for you it could be vboxnet0.

Then apply the following command:

 sudo route -nv add -net 192.168.59 -interface vboxnet1 

You should now be able to run docker commands.

See this issue for more information.

edit . Over time, I notice that the common denominator in this problem is cisco anyconnect (including me), fwiw

+57
Nov 07 '14 at 15:33
source share

I use OSX Yosemite and Cisco Anyconnect (which apparently are bad combos for using boot2docker), and the following finally worked for me (thanks to a related GitHub question ):

These steps will add a port forwarding rule and change your environment so that dockers point to 127.0.0.1 (instead of 192.168.59.103 or another NAT address).

First, boot2docker should be installed, but not running.

If it is currently running, stop it now:

 boot2docker down 

Add a rule to forward traffic from 127.0.0.1:2376 to port 2376 on boot2docker vm:

 vboxmanage modifyvm "boot2docker-vm" --natpf1 "docker,tcp,127.0.0.1,2376,,2376" 

Run boot2docker:

 boot2docker up 

Set the default DOCKER environment variables:

 $(boot2docker shellinit) 

Override the DOCKER_HOST variable to point to 127.0.0.1 :

 export DOCKER_HOST=tcp://127.0.0.1:2376 

You should now be able to run docker commands:

 docker version 
+64
Jan 06 '15 at 18:24
source share

Here is what I did to fix the problem (I use OSX Yosemite and the accepted answer did not work for me):

  • boot2docker delete - Warning: deletes all your boot2docker delete images.
  • In Virtualbox, go to VirtualBox (menu) => Settings => Network => Only host networks
    • Remove only host networks, then I added them again
  • boot2docker init
  • boot2docker up

Now Docker works from the OS X command line through iTerm2 for me.

+45
Nov 09 '14 at 20:45
source share

This happened to me, and none of the above problems arose.

Today, thanks to the suggestion of my colleagues, I did not start my VPN at first. I rebooted my car and started with a docker in the beginning.

 boot2docker init boot2docker up $(boot2docker shellinit) docker run hello-world 

Worked as expected!

I found this post by Florian Rosenberg useful. I read it in detail, but I think that most of what it offers in the first part was taken into account in the latest version of boot2docker. But the insightful bit: "Connecting to VPN Things will break." He suggested looking for a firewall rule that denies any of them. So, without a VPN, I was looking for this rule, and it was not there. Of course, as soon as I activated my VPN, I got the following (other) error ...

 docker run hello-world 2014/11/13 11:11:18 Post https://192.168.59.103:2376/v1.15/containers/create: dial tcp 192.168.59.103:2376: permission denied 

I checked the firewall rules and, of course, a new rule was added ... sudo ipfw -a list | grep "deny ip" 00411 1 64 deny ip from any to any

As soon as I remove this firewall rule with: sudo ipfw remove 00411

I managed to talk to the docker from the OSX command shell.

+6
Nov 13 '14 at 16:30
source share

Well, that is what happened to me.

First of all, you need to set environment variables. But then I continued to get an I / O timeout error even after that.

So, instead of launching boot2docker, by launching the application package (by clicking the boot2docker icon), I started it from the command line.

I first performed

 $boot2docker init 

This indicates that the VM is already running.

Then I went ahead and tried to run it.

 $boot2docker start 

This launched it.

You can check it by running

 $boot2docker info 

It prints JSON about your running instance.

Then you can enable ssh and run

 $boot2docker ssh $docker run hello-world 

What is it. Hope this helps.

+5
Nov 03 '14 at 4:56
source share

I had this problem after starting Cisco AnyConnect. Even after I closed AnyConnect, the problem continued. @ Treehau5's answer works, but what also worked for me was boot2docker poweroff , and then using Activity Monitor, kill the ciscod left by AnyConnect. Then I opened a new terminal window and started boot2docker normally, and docker commands were executed normally.

+4
Nov 09 '14 at 6:12
source share

It was easy for me. I updated the virtual box, and this problem disappeared.

+3
Dec 25 '14 at 7:05
source share

I tried the treehau5 method, but that did not work. I changed the VirtualBox Network setting in the boot2docker vm setting - "Host-only adapter" Hosted mode for "Allow all"

+2
Mar 02 '15 at 20:06
source share

I removed vboxnet0 from the VirtualBox settings and initialized the second boot2docker vm (boot2docker --vm = "boot2docker-vm2" init) to recreate vboxnet0 with the correct settings. After that, everything seemed normal.

0
Feb 28 '15 at 19:48
source share

Here is what worked for me when I hit a similar snag. Make sure you update VirtualBox, and then:

  • boot2docker stop
  • boot2docker init
  • boot2docker start; eval "$(boot2docker shellinit)"

Then, just for the sake of common sense, make sure $DOCKER_HOST matches $(boot2docker ip) . I suspect I have a lot going on, because when I first started, $DOCKER_HOST somehow stopped.

The problem and some discussions can be found on the GitHub problems page here - it rather seems like it's often just a case of VirtualBox being flaky.

0
Jul 24 '15 at 16:41
source share

Have you checked the DOCKER_HOST environment variable? He must point to

export DOCKER_HOST = tcp: //192.168.59.103: 2376

-one
Nov 01 '14 at 11:02
source share

In my case, I just had to restart my Mac computer machine and the problem went away! I have not been connected to a VPN or something like that. I'm not sure why this happened.

-one
Jun 25 '16 at 17:55
source share



All Articles