I have been playing around with LXD the past few nights, and so far I really like it. It’s like VMs, but as a container, in contrast with Docker, which is designed around running a single application as a container.
In order to try LXD out I installed a Ubuntu 15.10 VM and added the LXD stable PPA. Then it was time to launch some containers!
lxc remote add images images.linuxcontainers.org lxc image copy images:debian/jessie/amd64 local: --alias jessie-amd64 lxc launch jessie-amd64 jessie-test
Shortly after I hit a problem: I could not stop the container I just created! It would just hang there, so I had to stop it forcefully:
lxc stop --force jessie-test
That doesn’t look good at all. Digging around I found the issue on GitHub, which basically concludes that it’s a systemd issue, because it doesn’t seem to handle SIGPWR correctly. Oh boy. The systemd issue is still open on Launchpad, so what do we do then? Well, we get rid of systemd. Let’s prepare a base Debian Jessie image with good old SysV init, shall we?
lxc exec jessie-test /bin/bash apt-get update && apt-get install sysvinit-core exit lxc stop jessie-test --force lxc start jessie-test lxc exec jessie-test /bin/bash apt-get remove --purge --auto-remove systemd rm -rf /var/lib/apt/lists/* rm -rf /var/cache/apt/archives/* exit lxc stop jessie-test lxc publish jessie-test --alias jessie-amd64-base-sysvinit
Now all containers we create with our new and shiny image will stop gracefully.