As you already know Docker Daemon only works on Linux Operating Systems, and for Mac OS we usually run a virtual machine running any of the recent Linux distribution to setup a Docker Host. The project named machine from Docker Inc. makes it very easy to get this done.

Docker machine can be used to create docker hosts on a variety of infrastructure including your local machine (using any virtualisation software) and on various Public and Private Clouds.

To use docker machine first we should get a latest build from the projects github releases page ( Download the latest and appropriate build for your operating system.

Once you have the binary on your machine, move it to /usr/local/bin. Create /usr/local/bin if it doesn’t exist already

$ sudo mkdir -p /usr/local/bin
$ sudo cp docker-machine_darwin-amd64 /usr/local/bin/docker-machine
$ sudo chmod +x /usr/local/bin/docker-machine

Now you have docker-machine installed and you can check the version by running,

$ docker-machine -v
docker-machine version 0.4.1 (e2c88d6)

Now to create a docker machine we should have any of the docker-machine supported virtualisation software installed. We will be using VirtualBox, as its free. Get the latest version of VirtualBox from and install it.

Once VirtualBox is installed we can use docker-machine to create the docker host.

$ docker-machine create -d virtualbox dev
Creating CA: /Users/athiyara/.docker/machine/certs/ca.pem  
Creating client certificate: /Users/athiyara/.docker/machine/certs/cert.pem  
Image cache does not exist, creating it at /Users/athiyara/.docker/machine/cache...  
No default boot2docker iso found locally, downloading the latest release...  
Downloading to /Users/athiyara/.docker/machine/cache/boot2docker.iso...  
Creating VirtualBox VM...  
Creating SSH key...  
Starting VirtualBox VM...  
Starting VM...  
To see how to connect Docker to this machine, run: docker-machine env dev  

In the above command -d is used to specify the driver using which docker-machine should create the docker host for you. Here docker-machine downloads a copy of boot2docker.iso and creates a VirtualBox VM based on that iso file.

Now you can get the configurations to connect to this docker-machine as shown below

$ docker-machine env dev
export DOCKER_TLS_VERIFY="1"  
export DOCKER_HOST="tcp://"  
export DOCKER_CERT_PATH="/Users/docker/.docker/machine/machines/dev"  
export DOCKER_MACHINE_NAME="dev"  
# Run this command to configure your shell: 
# eval "$(docker-machine env dev)"

Now you can export the above variables and get your docker client which runs on your macbook to connect to this docker server.

$ eval $(docker-machine env dev)

Now get the latest release of docker client from the github release page ( and move the binary to /usr/local/bin and set execute permission.

sudo mv docker-1.8.2 /usr/local/bin/docker  
sudo chmod +x /usr/local/bin/docker  

Now from the shell you can use docker commands (you should export the variables as shown in the previous step)

$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

$ docker pull busybox
Using default tag: latest  
latest: Pulling from library/busybox

cfa753dfea5e: Pull complete  
d7057cb02084: Pull complete  
library/busybox:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.

Digest: sha256:16a2a52884c2a9481ed267c2d46483eac7693b813a63132368ab098a71303f8a  
Status: Downloaded newer image for busy box:latest

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE  
busybox             latest              d7057cb02084        5 days ago          1.096 MB