systemd-nspawn Command Examples

Spawn a command or OS in a lightweight container. More information: https://www.freedesktop.org/software/systemd/man/latest/systemd-nspawn.html.

systemd-nspawn --directory {{path/to/container_root}}

systemd-nspawn --boot --directory {{path/to/container_root}}

systemd-nspawn --directory {{path/to/container_root}} --as-pid2

systemd-nspawn --machine={{container_name}} --hostname={{container_host}} --directory {{path/to/container_root}}