brew install boot2docker
To initialize the linux VM and setup your shell, run:
boot2docker --iso-url=https://github.com/boot2docker/boot2docker/releases/download/v1.5.0/boot2docker.iso download boot2docker init boot2docker start $(boot2docker shellinit)
The first line is to avoid an issue with docker client/server version mismatch, as discussed here.
The last line exports the necessary environment variables in order to interact with the docker daemon inside the virtual machine from the OSX host.
You should be able to verify that the docker client on OSX can connect to the server running inside of the virtual machine by running
docker images, for example, and seeing no errors...
$ docker images ~/code/docker-example REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
Fetching a base container
To fetch the official Ubuntu 12.04 base container, run:
docker pull ubuntu:12.04
To view this image, run:
...it will likely be listed multiple times since it can be referenced multiple ways (12.04, precise, 12.04.5).
Take a look at the
Dockerfile in this repo. Feel free to change the
MAINTAINER to your own account on docker hub, so you can push later.
To build a docker image from this file, run:
docker build -t dicato/docker-example:v1 .
dicato with your username.
To run a container off of this image, run:
docker run -p 8000:8000 -t -i dicato/docker-example:v1
Since the container is being run interactive, you should see the output of runserver:
...<snip>... February 12, 2015 - 03:37:50 Django version 1.7.4, using settings 'docker_example.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C.
From OSX, determine the IP address of the
boot2docker virtual machine:
Connect the the django
runserver with a browser by navigating to
Pull this container
Don't feel like walking through this step by step? Just pull this container from the docker registry and run it:
docker pull dicato/docker-example docker run -p 8000:8000 -t -i dicato/docker-example:v1
Get this container running in a coreos cluster...