Saving desktop from Docker
I do some patches for testinfra project. They use Docker as test engine. When I run those things on my linux laptop with local dockerd, the result was devastating. Something crazy start to happen. Minute-long freezes, random hostname changes (and I swear, there was no easy way to run root code run on my machine, as sudo is password-protected), etc.
I absolutely don’t want to dig into reasons of that, but I noticed that all components of my system went convulsing. logind, journald, udev — thousands of devices, etc, etc.
I realized that Docker is a very intrusive software for a desktop. I heard some mac users was envy that I can run Docker natively. They shouldn’t be.
… because I found a perfect solution for this problem: shift Docker into a virtual machine. QEMU virtual machine is a well-behaving userspace process with no thousands of device appearances and disappearances.
There is no docker-machine for Linux, but, really, we don’t need one.
Here are my humble playbooks to configure docker into VM:
https://github.com/amarao/local_vm_with_docker
The secret sauce there is adding of DOCKER_HOST
variable into my .bashrc
.
Those playbooks does not provide VM itself; you can do it in any way you want (I done it manually). To use them fill inventory, run those two playbooks, and you are good to go.
When I run the same testinfra tests caused havoc on my laptop inside VM’s docker, the result was drastic: everything went smooth, no freezes, no frenzy in systemd’s journal.
Shall we discuss the isolation level containers provides?