Docker VM on OS X installed but commands appear to fail [closed]

Solution 1:

A couple things to check:

Updated version of boot2docker

Check that your boot2docker is up to date. If you had installed through an application such as Homebrew, you might be running an older version. Check the official releases at https://github.com/boot2docker/osx-installer/releases. Be sure to run boot2docker delete and then boot2docker init after upgrading.

Updated Docker client

It is probably a good idea to run a Docker client that matches the version of server running in boot2docker. If you are running Docker 1.0 in boot2docker, make sure you have the 1.0 client from https://github.com/boot2docker/osx-installer/releases.

Export correct port

The port in your commands may not be correct. Did you remember to run export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375 like the documentation says? Port 2375 is the new default for Docker 1.0 (which is in both boot2docker 0.9.1 and 1.0.0).

Forward correct port

After updating the DOCKER_HOST for the client, you may run into an issue with boot2docker 0.9.1 which used the wrong port for Docker TCP connections. Steps to check:

  1. Login to the boot2docker VM using boot2docker ssh (password is tcuser).
  2. Then check the listening port using sudo netstat -ntpl | grep docker (probably 2375).
  3. Now open up VirtualBox, go to the settings of the boot2docker VM, then click the Port Forwarding button.
  4. It should match the port listening in boot2docker (possibly 2375).
  5. If the port doesn't match, try updating the port forwarding, then try the client again.

Solution 2:

Andy got me 99% of the way there. I'm marking his answer as the accepted answer, but I'll write here what solved my issue. After installing the correct version (1.0.0) of boot2docker, I was still getting incorrect output from any Docker commands.

I then opened up VirtualBox and read the ports, and, lo and behold, the ports were incorrect. However, switching them to the correct values did not fix the problem.

I decided to reset the VM, since the old boot2docker probably set it up incorrectly. The following commands ended up fixing the issue.

$ boot2docker delete
$ boot2docker init
$ export DOCKER_HOST=tcp://:2375