None of this is really necessary now that the Docker team is releasing official Mac OS X binary builds. Please see moby/moby#3337 for details.
You may also wish to check out this convenience wrapper for setting up essentially what I describe below: https://github.com/noplay/docker-osx
Use the binary .pkg installer for go 1.2 (or later) from golang.org.
If you choose the defaults, it isn't necessary to set the $GOROOT
environment variable, and the go
binary will be in your $PATH.
You may have to start a new Terminal window to see these changes.
$ brew rm --force go # if you had go installed via homebrew
$ # (download and double-click on the .pkg installer now)
$ brew install mercurial
$ # The next 2 lines probably should go in ~/.bash_profile or the like
$ export GOPATH=$HOME/Projects/gowork # or wherever
$ export PATH=$PATH:$GOPATH/bin
$ go version
go version go1.2 darwin/amd64
Docker client and server apparently need to agree exactly on a version string or resource, so ensure that you build your Mac OS X docker client and provision your Linux VM docker server from the same local repository checkout.
$ cd $GOPATH
$ go get -v github.com/dotcloud/docker/docker
$ cd src/github.com/dotcloud/docker
$ git checkout v0.7.2
$ CC=clang go install -a
Edit the Vagrantfile in the docker repository (your current directory if you have been following along). Add the following line inside the Vagrant::Config.run block (in v0.7.2, at line 101):
config.vm.forward_port 4243, 4243
Save the vagrantfile and run vagrant up
to create a box running the
docker daemon. SSH into the box and sudo edit the /etc/init/docker.conf
upstart daemon file and add the -H argument, so the last two lines are
like this:
"$DOCKER" -H tcp://0.0.0.0:4243 -d $DOCKER_OPTS
end script
Now restart the docker daemon:
Now log out, then reboot the VM using vagrant reload
so the docker port
is exported at 4243.
Back in Mac OS X... Rather than specify a host argument each time we invoke docker, let's just set an alias in ~/.bash_profile: alias docker='docker -H tcp://127.0.0.1:4243/'
Then run docker version
and you should see this:
Go version (client): go1.2
Server version: 0.7.2
Git commit (server): 88df052
Go version (server): go1.2
Last stable version: 0.7.2
The Docker issue I mentioned now has info on how to build a functional OSX client: moby/moby#3683