Systemd/Nspawn

From Bibliotheca Anonoma

Sometimes I need to do development using a Debian-based system, but I usually use Arch or Fedora.

Thus, I set up a chroot to run such systems with no performance loss. Heck, I even throw in systemd-nspawn to spice things up.

Installation[edit]

Fedora[edit]

su -c 'dnf install debootstrap dpkg'

http://blog.parahard.com/2013/03/creating-debian-chroot-inside-fedora.html

Usage[edit]

You can set up multiple types of distros under the chroot.

Debian[edit]

debootstrap --arch=amd64 unstable debian-tree/

http://blog.exppad.com/article/a-docker-like-container-management-using-systemd

Management[edit]

Systemd provides some helpful utilities to manage containers:

machinectl[edit]

https://wiki.archlinux.org/index.php/Systemd-nspawn#machinectl

nSpawn[edit]

https://gist.github.com/aputs/0476fd313a86c66a6927

   #!/bin/bash
   # boot the container as given in first argument
   sudo systemd-nspawn -d "$1" --boot

Docker[edit]

https://www.digitalocean.com/community/tutorials/docker-explained-how-to-create-docker-containers-running-memcached

https://docs.docker.com/engine/userguide/dockerimages/

Docker does all of this for you.