Containers don't usually share the init. Most of the time, containers create a PID namespace, which makes the first forked process in the namespace PID1, so you can actually run a different init in the container. systemd-nspawn (a simple container runtime), however, has some useful integrations if you use systemd inside the container.
That said, it's possible to make a container that doesn't share init, you just don't create a PID namespace. Most of the popular container runtimes are either emulating VMs (systemd-nspawn, lxc/lxd) or designed to ease immutable deployments (docker, rkt), and in both of these cases, it is useful to create a PID namespace, so popular container runtimes don't share init.
View all comments
Show parent comment
2
u/moosingin3space Jul 17 '17
Containers don't usually share the init. Most of the time, containers create a PID namespace, which makes the first forked process in the namespace PID1, so you can actually run a different init in the container.
systemd-nspawn(a simple container runtime), however, has some useful integrations if you usesystemdinside the container.That said, it's possible to make a container that doesn't share init, you just don't create a PID namespace. Most of the popular container runtimes are either emulating VMs (
systemd-nspawn,lxc/lxd) or designed to ease immutable deployments (docker,rkt), and in both of these cases, it is useful to create a PID namespace, so popular container runtimes don't share init.