On Linux, the default init program is usually systemd. The main job of the default init program is typically to be a process manager. That is, it starts other programs and can restart them if they crash. Since it's the first process to start (PID 1), if it exits the kernel can't continue and will panic, usually followed by a reboot.
Containers work similarly, except that they don't take the whole system down when their PID 1 exits. That's why containers often don't have a process manager inside, but Linux based operating systems do.