How does Docker run a Linux kernel under macOS host?

Docker is using Apple's Hypervisor Framework: https://developer.apple.com/reference/hypervisor

More reading on the Docker blogs for when then came out last year: https://blog.docker.com/2016/05/docker-unikernels-open-source/


While the other answers are correct about the hypervisor, they don't answer your specific question.

The answer is "Docker [Desktop] for Mac" does run a Linux host VM with a replacement for boot2docker - LinuxKit developed and maintained by Docker for the purpose of making lightweight distributions.

https://blog.docker.com/2017/04/introducing-linuxkit-container-os-toolkit/

The uname you saw didn't have the keyword in it, but it seems to be included now, e.g. from Docker for Mac 18.03.1 I see:

Linux a8e079429a51 4.9.87-linuxkit-aufs #1 SMP Wed Mar 14 15:12:16 UTC 2018 x86_64 Linux

You can see links to the included versions on the release pages. https://docs.docker.com/docker-for-mac/release-notes/

So it's not so different from the old days Docker Machine + VirtualBox + boot2docker,

for the new days, it's just the provisioning is done internally by "Docker [Desktop] for Mac" and VirtualBox is replaced by Apple's Hyperkit, and the "default VM" is a bit more tucked away.


The early version Docker used VirtualBox to run virtual machine for Docker. Since June 2016, the way to run Docker on Mac and Windows became much simpler, there's the official release introduction blog for Docker on Mac/Windows, and there's also some introduction from docker mac website:

Docker for Mac is a complete development environment deeply integrated with the MacOS Hypervisor framework, networking and filesystem.

And with the structure looks like:

enter image description here