Andrew Connell

Docker for macOS Beta

Docker created a native app for macOS/Windows & made the part of hosting the engine for you transparent. No more VM or VirtualBox required! Depending on your OS, Docker works directly with the underlying OS' hypervisor stack.

Last night I got a little surprise: an email invitation to the beta for Docker for Mac that included an invite code. I had forgotten I had applied to be part of the private beta a few weeks / months ago so it was quite the pleasant surprise.

What’s the big deal?

Today, to run Docker containers, you need to have the Docker engine running. That’s presently supported on either Linux or the latest preview of Windows Server 2016 (Tech Preview 5) . Let’s say you’re on your laptop, how do you get up and running?

Typically you install virtualization software like Hyper-V (on Windows), VMWare or if you follow their Getting Started pages, you download VirtualBox and host Docker on a Linux VM. Its a bit cumbersome and uses up extra resources on your machine to run some host process. It works just fine but Docker wanted to improve on the story.

Introducing Docker for Mac & Windows

What Docker did was create a native application that ran on either Mac or Windows and made the part of hosting the engine for you transparent. No more VM or VirtualBox required! Depending on your OS, Docker for Mac/Windows works directly with the underlying operating system’s hypervisor stack (Hyper-V on Windows, xhyve on OSX). This is is a much thinner layer than using VirtualBox or VMWare and has been tailor made for Docker workloads on Windows or Mac… great for development!

You can read more about Docker for Mac & Windows here: Docker for Mac & Docker for Windows .

Installing & Running Your First Container

I work primarily on my MacBook Pro so I downloaded the Docker for Mac beta. I have a Surface with Windows 10 and tried the same thing out with the same great experience, but I’ll focus on the OSX experience.

First up, download & open the installer (*.dmg). Just like easy OSX installs, just drag the file to my Applications folder.

Scaled image

Install Docker for macOS

The installer then prompted for admin access to my machine to hook into the hypervisor… no shocker there… just accept a few security warnings, provide my admin password and we’re off:

Scaled image

Grant Docker for macOS privledged access to hook into the hypervisor

It even noticed I had VirtualBox with a Linux VM that had Docker installed on it with some containers I had been working on. It asked if I wanted to pull those things in from that VM into the new Docker setup. Pretty slick! I declined as I wanted to start clean:

Scaled image

Migrate existing Docker tools for VMs into your Docker for macOS VM

A few seconds later and there’s the container whale in my menu bar. Nice quick link to the docs, a welcoming animated terminal window saying “now just do what you’re used to doing”. Whole download & install process took about two minutes.

Scaled image

Docker for macOS in the Menu Bar

The app also has a some settings you can modify… only a few which is nice so it’s not overly complex:

Scaled image

Docker settings

Scaled image

Advanced Docker settings

Now that I’m all setup, let me give this a shot. So I fire up my terminal, run a few familiar commands and decide “let’s download the simple nginx web server and run it… let’s see if we can get a website hosted on my localhost. So here we go. I first run docker info to see the current state… we have zero images downloaded and zero containers. I then tell it to run a container in detached mode (-d), map port 80 in the container to my host’s port 80 (-p 80:80), give the container the name webserver and use the image (from the public Docker Hub Registry) named nginx:


You see it pulls down the different images needed to build the nginx image and runs it, returning the ID of the image.

Is it running? So I then run docker ps to give me a list of all running docker processes (containers) and you see there’s one listed with the first part of the ID listed:


Looks good! This was easily verified by opening up the browser in OSX and going to http://localhost where I saw the default nginx page. So easy! Top stop the container I just ran docker kill [container_id] to kill the running container.

So much easier than running a virtual machine and the overhead of VirtualBox!

Andrew Connell
Founder & Chief Course Artisan, Voitanos LLC. | Microsoft MVP
Written by Andrew Connell

Andrew Connell is a web developer with a focus on Microsoft Azure & Microsoft 365. He’s received Microsoft’s MVP award every year since 2005 and has helped thousands of developers through the various courses he’s authored & taught. Andrew’s the founder of Voitanos and is dedicated to delivering industry-leading on-demand video training to professional developers. He lives with his wife & two kids in Florida.