Creating a local Swarm in VirtualBox or Hyper-V

Sometimes, a single node Swarm is not enough, but we don't have or don't want to use an account to create a Swarm in the cloud. In this case, we can create a local Swarm in either VirtualBox or Hyper-V. Creating the Swarm in VirtualBox is slightly easier than creating it in Hyper-V, but if you're using Windows 10 and have Docker for Windows running, then you cannot use VirtualBox at the same time. The two hypervisors are mutually exclusive.

Let's assume we have VirtualBox and docker-machine installed on our laptop. We can then use docker-machine to list all Docker hosts that are currently defined and may be running in VirtualBox:

$ docker-machine lsNAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS ...

Get Learn Docker - Fundamentals of Docker 19.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.