Perl programmer for hire: download my resume (PDF).
John Bokma's Hacking & Hiking

Getting Started with Docker for Mac

September 13, 2016

Today I finally was able to make some time to install Docker for Mac. Yesterday, in the evening I had already been rereading the first two chapters of The Docker Book by James Turnbull. This ebook is updated often and hence at 9.99 USD I consider this money well spent.

Installing Docker for Mac

On the Docker main page I clicked Get Started with Docker. On the page shown I clicked the large "Download Docker for Mac" button in order to get the download started.

If you prefer to download Docker for Mac on the command line and have wget installed, for example using Mac Ports, you can download the latest stable version as follows:


or using curl:

curl -o Docker.dmg

I launched the downloaded installer and dragged the "" icon and dropped it on the Applications icon per the instructions given to install Docker.

Next, I started the by opening it in my Applications folder. Since I had downloaded the application from the Internet OS X required me to confirm that I want to open it. I clicked "Open" and the Docker welcome dialog showed up; "We are whaly happy to have you."

I clicked its "Next" button and now the dialog warned that Docker needs privileged access to

install its networking components and links to the Docker apps.

You will be asked for your password.

I clicked the "OK" button and entered my password to give Docker the required privileges. The Docker icon was added to the menu bar and a notification was shown below it which informed me that Docker is now up and running. This notification also showed that Docker sends by default diagnostic and usage data. I turned this setting off.

Next, I ran docker info in a new terminal, which reported:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.12.0
Storage Driver: aufs
Kernel Version: 4.4.15-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.954 GiB
Name: moby

Quite some lines omitted for clarity.

Note that the Docker icon in the menu bar also gives access to the Preferences. For example you can change the number of CPUs Docker for Mac uses, or the amount of memory. It also allows you to uninstall Docker for Mac. I recommend to have a look at the Preferences to see what's available.

Run hello-world

I followed Step 3: Verify your installation in the official Docker documentation, and ran in a new terminal docker run hello-world. This showed the following output:

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c04b14da8d14: Pull complete 
Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:

For more examples and ideas, visit:

Next, I ran docker ps -a which showed the following output:

CONTAINER ID        IMAGE               COMMAND             CREATED
 STATUS                          PORTS               NAMES
be1dc28dcc54        hello-world         "/hello"            About a minute ago
 Exited (0) About a minute ago                       suspicious_goldstine

Accessing the "moby" Virtual Machine

Docker for Mac uses HyperKit to run a lighweight Alpine Linux virtual machine. As Docker Engine requires Linux it can be run this way yet give a native experience on OS X. The hypervisor in HyperKit is based on xhyve which itself is a port of the BSD hypervisor bhyve to OS X.

The virtual machine running Alpine Linux can be accessed using screen as follows:

screen ~/Library/Containers/com.docker.docker/Data/\

After I pressed Enter I was greeted with the following:

Welcome to Moby alpha
Kernel 4.4.15-moby on an x86_64 (/dev/ttyS0)

                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/

moby login:

Use root with no password to login. To quit the screen session use Ctrl+A Ctrl+\ and answer "Really quit and kill all your windows" with "y". Note that if you don't logout "root" using Ctrl+D, screen picks up where you left off the next time you start it.