23

I've installed boot2docker on OSX 10.8.5 and it seems that the installation went fine, but when I try to launch boot2docker I get the following, which hangs indefinitely:

$ /usr/local/bin/boot2docker up 
Waiting for VM and Docker daemon to start...
..........................................................................oooooooooooooooooooooooooooooo

What steps should I take to debug this? I haven't been able to find any information on this particular issue.

$ boot2docker version
Boot2Docker-cli version: v1.4.1
Git commit: 43241cb

$ docker version
Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 5bc2ff8
OS/Arch (client): darwin/amd64

$ boot2docker -v up
Boot2Docker-cli version: v1.4.1
Git commit: 43241cb
2014/12/23 00:19:25 executing: VBoxManage showvminfo boot2docker-vm --machinereadable
2014/12/23 00:19:25 executing: VBoxManage showvminfo boot2docker-vm --machinereadable
2014/12/23 00:19:25 executing: VBoxManage showvminfo boot2docker-vm --machinereadable
Waiting for VM and Docker daemon to start...
.Connecting to tcp://localhost:2022 (attempt #0).Connecting to tcp://localhost:2022 (attempt #0).Connecting to tcp://localhost:2022 (attempt #0).Connecting to tcp://localhost:2022 (attempt #0).Connecting to tcp://localhost:2022 (attempt #0).^C


In my ~/.bash_profile file:

export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/Me/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1


When I open VirtualBox, this what I see:

enter image description here


I've tried powering off and removing the boot2docker-vm using the Virtual Box GUI, and I get the following when I run boot2docker again:
$ /usr/local/bin/boot2docker init 
error in run: Failed to initialize machine "boot2docker-vm": exit status 2

And then:

$ /usr/local/bin/boot2docker up 
Waiting for VM and Docker daemon to start...
...............................................................…..

Which hangs endlessly.


Additionally

$ docker ps
FATA[0000] Couldn't read ca cert /Users/Me/.boot2docker/certs/boot2docker-vm/ca.pem: open /Users/Me/.boot2docker/certs/boot2docker-vm/ca.pem: no such file or directory

And:

$ sudo docker ps
FATA[0000] Get http:///var/run/docker.sock/v1.16/containers/json: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?


Following Sven's advice below deleted the boot2docker-vm again and run init in verbose mode:

    $ boot2docker -v init
Boot2Docker-cli version: v1.4.1
Git commit: 43241cb
2014/12/23 01:53:02 executing: VBoxManage showvminfo boot2docker-vm --machinereadable
2014/12/23 01:53:02 executing: VBoxManage showvminfo boot2docker-vm --machinereadable
2014/12/23 01:53:03 executing: VBoxManage list vms
2014/12/23 01:53:03 executing: VBoxManage createvm --name boot2docker-vm --register
Virtual machine 'boot2docker-vm' is created and registered.
UUID: eca00a0a-6d68-45f3-acd1-ccc4dd1bcec9
Settings file: '/Users/Me/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vbox'
2014/12/23 01:53:03 executing: VBoxManage showvminfo boot2docker-vm --machinereadable
2014/12/23 01:53:03 executing: VBoxManage setextradata boot2docker-vm VBoxInternal/CPUM/EnableHVP 1
2014/12/23 01:53:03 executing: VBoxManage modifyvm boot2docker-vm --firmware bios --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 0 --biosbootmenu disabled --natdnshostresolver1 off --natdnsproxy1 off --ostype Linux26_64 --cpus 8 --memory 2048 --vram 8 --acpi on --ioapic on --rtcuseutc on --cpuhotplug off --pae on --longmode on --synthcpu off --hpet on --hwvirtex on --triplefaultreset off --nestedpaging on --largepages on --vtxvpid on --vtxux off --accelerate3d off --uart1 0x3F8 4 --uartmode1 server /Users/AJB/.boot2docker/boot2docker-vm.sock --boot1 dvd
2014/12/23 01:53:03 executing: VBoxManage showvminfo boot2docker-vm --machinereadable
2014/12/23 01:53:03 executing: VBoxManage modifyvm boot2docker-vm --nic1 nat --nictype1 virtio --cableconnected1 on
2014/12/23 01:53:03 executing: VBoxManage controlvm boot2docker-vm natpf1 ssh,tcp,127.0.0.1,2022,,22
2014/12/23 01:53:03 executing: VBoxManage list hostonlyifs
2014/12/23 01:53:03 executing: VBoxManage list dhcpservers
2014/12/23 01:53:03 executing: VBoxManage hostonlyif create
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
2014/12/23 01:53:03 executing: VBoxManage hostonlyif ipconfig dyld: DYLD_ environment variables being ignored because main executable (/Applications/VirtualBox.app/Contents/MacOS/VBoxNetAdp --ip 192.168.59.3 --netmask 255.255.255.0
VBoxManage: error: The host network interface with the given name could not be found
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component Host, interface IHost, callee nsISupports
VBoxManage: error: Context: "FindHostNetworkInterfaceByName(name.raw(), hif.asOutParam())" at line 218 of file VBoxManageHostonly.cpp
VBoxManage: error: Could not find interface 'dyld: DYLD_ environment variables being ignored because main executable (/Applications/VirtualBox.app/Contents/MacOS/VBoxNetAdp'
error in run: Failed to initialize machine "boot2docker-vm": exit status 2


Thanks in advance for any help.

AJB
  • 7,389
  • 14
  • 57
  • 88
  • I would say that `$ /usr/local/bin/boot2docker init error in run: Failed to initialize machine "boot2docker-vm": exit status 2` is an indication that the vm wasn't properly deleted by the virtualbox GUI. I would do that again, and then run `boot2docker -v init` to see the verbose output. This may point towards the problem. – SvenDowideit Dec 23 '14 at 06:51
  • 1
    you _really_ should not hard-code the DOCKER env vars into your .bashrc file - the vm's IP address can be changed by virtualbox at any time. Instead, have it run `$(boot2docker shellinit)` – SvenDowideit Dec 23 '14 at 06:55
  • Which should I have run `$(boot2docker shellinit)`? – AJB Dec 23 '14 at 06:57
  • your ~/.bash_profile? – SvenDowideit Dec 23 '14 at 07:01
  • Okay, added `$(boot2docker shellinit)` to my `.bash_profile`, attempted to `. .bash_profile` and got `error in run: Failed to get machine "boot2docker-vm": machine not exist`. Ran `boot2docker` from the tray icon again and it hung again. Killed `boot2docker up` and tried to `source` my `.bash_profile` again and now terminal is just hanging. – AJB Dec 23 '14 at 07:07
  • I would uninstall and re-install everything except I've already done that twice so I'm not sure what to try anymore. – AJB Dec 23 '14 at 07:09
  • oh. now this sounds familiar - https://github.com/boot2docker/boot2docker/issues/525#issuecomment-59047975 suggests that you need to delete the vm using the vbox GUI and then also delete the `/Users//VirtualBox VMs/` dir. – SvenDowideit Dec 23 '14 at 07:17
  • There is also the possibility that the vbox host only networking settings are wrong (outside the vm itself). I'm not sure where in the menu's that is atm, i'm on my chromebox. – SvenDowideit Dec 23 '14 at 07:18
  • Network Adapter: `Attached to NAT`. Port forwarding: `Name: SSH, Protocol: TCP, Host IP: 127.0.0.1, Host Port: 2222, Guest IP: , Guest Port: 22`. Well, that `2222` looks familiar. But what should it be set to? – AJB Dec 23 '14 at 07:23
  • Sorry, the above should read: That `2022` looks familiar. – AJB Dec 23 '14 at 07:36
  • 1
    I've determined that by changing the `Host Port` setting using the VBox GUI it will cause `boot2docker up -v` to attempt connection on the newly declared port, not the old `2022`. But what port should this be set to? – AJB Dec 23 '14 at 07:38
  • I notice the little preview screen in your VirtualBox manager says (in teeny tiny print), `"FATAL: Could not read from the boot medium! System halted."` This fits with the actual VM image being bad, so deleting that VM image is a good idea. I've just run into this problem upon my very first setup using boot2docker. (And I'm actually still having trouble getting `boot2docker init` to complete making a new image...) – broc.seib Feb 14 '15 at 18:22

4 Answers4

25

I run into same problem on OSX Yosemite and have to do the following:

1) clean stuff with docker

  • boot2docker delete - Warning: this deletes all your docker images.
  • In Virtualbox, go to VirtualBox (menu) => Preferences => Network => Host Only Networks
    • Delete the host only networks, then I re-added them
  • boot2docker init
  • boot2docker up

2) very important, and you probabbly are missing it dealing with environmental variables, as they say:

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/andi/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1

For you the second export command will differ by user name - not andi, but something else. Just copy paste, and hit enter to apply this env variable, and then run e.g docker ps to check either thinks are working properly.

andilabs
  • 22,159
  • 14
  • 114
  • 151
5

Upgrading Virtual Box is the key but I did this before the upgrade to 4.3.26:

  • Remove all from Virtual Box -> Preferences -> Network -> Host-only Networks
  • Remove existing boot2docker-vm in Virtual Box
  • Install the new version of Virtual Box
  • Run boot2docker application
trung
  • 1,104
  • 11
  • 13
3

For what it is worth, I tried all the solutions in this question and in this related question and none resolved my issue until I uninstalled and re-installed VirtualBox. This process upgraded the VirtualBox from version 4.2.16 to 4.3.22 (my previous one had been lying unused on the system for a few months).

Then boot2docker and docker worked without any other adjustments.

Community
  • 1
  • 1
daedalus
  • 10,873
  • 5
  • 50
  • 71
0

Had similar problem. It was cisco anyconnect vpn client which messed everything up for me. I found out from the internet that the simplest possible way of fixing this would be:

boot2docker stop
vboxmanage modifyvm "boot2docker-vm" --natpf1 "docker,tcp,127.0.0.1,2376,,2376"
boot2docker up
$(boot2docker shellinit)
export DOCKER_HOST=tcp://127.0.0.1:2376

Starting from this point everything worked just fine even after restarting vpn client.

Viktor
  • 189
  • 1
  • 6