systemd containers

systemd-nspawn and machinectl are lightweight container management tools.

They are deployed as part of systemd with the systemd-container package.

Usage example

Deploy FreedomBox on a Sid container. This will take around 1.2 GB of disk space.

# create a new container using debootstrap
$ CDIR=/var/lib/machines/freedombox
$ sudo debootstrap sid $CDIR
$ sudo systemd-nspawn -D $CDIR --machine FreedomBox
root@FreedomBox:~# apt-get install -y freedombox-setup

# set root password and stop the container
root@FreedomBox:~# passwd root
root@FreedomBox:~# ^D

# start the container and its services
$ sudo systemd-nspawn -D $CDIR --machine FreedomBox -b

# Browse to https://127.0.0.1/

# To stop the container, either issue:
$ sudo machinectl stop FreedomBox

# or log in and run "halt". Simply logging out does not stop a container started with "-b"