You are here

How to Use Docker on macOS

Step 1

Go here and do what's written on it.

Step 2

You have two choices: the offical package from the Docker site or homebrew. I prefer homebrew because I like to manage my environment from the command line. The choice is yours.

brew update
brew install docker
brew install boot2docker

Step 3

First, we need to initialize boot2docker (we only have to do this once):

 boot2docker init
2014/08/21 13:49:33 Downloading boot2docker ISO image...
[ ... ]
2014/08/21 13:49:50 Done. Type `boot2docker up` to start the VM.

we can start up the VM. Do like it says:

boot2docker up
2014/08/21 13:51:29 Waiting for VM to be started...
.......
2014/08/21 13:51:50 Started.
2014/08/21 13:51:51 Trying to get IP one more time
2014/08/21 13:51:51 To connect the Docker client to the Docker daemon, please set:
2014/08/21 13:51:51 export DOCKER_HOST=tcp://192.168.59.103:2375

Step 4

The Docker client assumes the Docker host is the current machine. We need to tell it to use our boot2docker VM by setting the DOCKER_HOST environment variable:

export DOCKER_HOST=tcp://192.168.59.103:2375

 

Step 5

 docker info
Containers: 0
Images: 0
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Dirs: 0
Execution Driver: native-0.2
Kernel Version: 3.15.3-tinycore64
Debug mode (server): true
Debug mode (client): false
Fds: 10
Goroutines: 10
EventsListeners: 0
Init Path: /usr/local/bin/docker
Sockets: [unix:///var/run/docker.sock tcp://0.0.0.0:2375]