I am using Docker CE v18.06.0-ce-mac70 (26399). Does it still need VirtualBox to run containers? Would Docker still run if I uninstall my VirtualBox?
Good question. Seems confusing based on the documentation which states:
But then states:
Currently, there is no
docker-machine createdriver for HyperKit, so use the
virtualboxdriver to create local machines. (See the Docker Machine driver for Oracle VirtualBox.) You can run both HyperKit and Oracle VirtualBox on the same system. To learn more, see Docker for Mac vs. Docker Toolbox.
So it seems like if you are not concerned about
docker-machine create then you can use Docker CE without VirtualBox installed. But if you ask me, it seems that at some point you might get snagged while playing around with containers, so the best bet is to keep VirtualBox installed.
My personal best advice is if you don’t want VirtualBox around, just ditch it for now and do as you wish with Docker CE. And if/when you hit some command wall—such as the
docker-machine create item mentioned above—then just install VirtualBox and accept that as the “price of admission” for using Docker on macOS.
Here's a quick update on the issue: According to the official documentation on https://docs.docker.com/docker-for-mac/docker-toolbox/:
Docker Desktop for Mac uses HyperKit instead of Virtual Box. Hyperkit is a lightweight macOS virtualization solution built on top of Hypervisor.framework in macOS 10.10 Yosemite and higher.
It comes with a major limitation though:
Also note that Docker Desktop for Mac can’t route traffic to containers, so you can’t directly access an exposed port on a running container from the hosting machine.
If you do need multiple VMs, such as when testing multi-node swarms, you can continue to use Docker Machine, which operates outside the scope of Docker Desktop for Mac. See Docker Toolbox and Docker Desktop for Mac coexistence.
So while Hyperkit is the closest thing to native virtualisation on macOS and might cause less overhead than VirtualBox based docker environments, it also lacks the capabilities to expose your containers on the network.
Personally, I don't think this is a huge deal since few people run mac based servers and when they do, a graphical user interface shouldn't be the show stopper. Docker Toolbox still uses Virtualbox and will provide a command line interface to run whatever you need on the network.