running a docker cluster on your home computer

I want to do some experiments with Docker on my home computer, but I don’t want to use a single node, like Docker for Mac provides. I want to run a full 5 node Docker swarm, but building and running 5 linux virtual machines is a pain in the ass, so I used Ubuntu and LXD.

You can run Docker inside LXD containers, so all I had to do was create a single 4 cpu, 16 GB VirtualBox VM, with 2 64 GB virtual disks, running Xubuntu 18.04 beta, and install LXD there, using the /dev/sdb for LXD container storage. On that Xubuntu host, I wrote a few shell scripts to help me build my docker swarm automatically.

build.sh launches 5 LXD containers running Ubuntu:16.04 and the latest Docker-CE
stop.sh stops all 5 LXD containers
delete.sh deletes all 5 LXD containers from disk

You have to run “lxc exec docker1 bash” to start a shell on the Docker master node to run normal docker commands, or else prefix them each with “lxc exec docker1 –” to run docker from the LXD host. For example, “lxc exec docker1 — docker info | less”

Comments are closed.