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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.