From c91fd38d59f32bd7f080c4c1f80badd1efca963a Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Mon, 6 Nov 2023 23:25:39 +0530 Subject: [PATCH] systemd-nspawn: add page (#11398) Signed-off-by: K.B.Dharun Krishna Co-authored-by: Shashank Hebbar --- pages/linux/systemd-nspawn.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 pages/linux/systemd-nspawn.md diff --git a/pages/linux/systemd-nspawn.md b/pages/linux/systemd-nspawn.md new file mode 100644 index 000000000..a2f7cc53a --- /dev/null +++ b/pages/linux/systemd-nspawn.md @@ -0,0 +1,20 @@ +# systemd-nspawn + +> Spawn a command or OS in a lightweight container. +> More information: . + +- Run a command in a container: + +`systemd-nspawn --directory {{path/to/container_root}}` + +- Run a full Linux-based OS in a container: + +`systemd-nspawn --boot --directory {{path/to/container_root}}` + +- Run the specified command as PID 2 in the container (as opposed to PID 1) using a stub init process: + +`systemd-nspawn --directory {{path/to/container_root}} --as-pid2` + +- Specify the machine name and hostname: + +`systemd-nspawn --machine={{container_name}} --hostname={{container_host}} --directory {{path/to/container_root}}`