Skip to main content

KEEP_ALIVE

Constant KEEP_ALIVE 

Source
pub const KEEP_ALIVE: &[&str];
Expand description

What a lasting container runs so that it stays up between tabs.

Tabs enter a container that is already running, so it needs something that never ends and costs nothing, and it has to go away the moment it is told to. The two do not come for free together: the command is the container’s first process, and a first process only sees a signal it has a handler for, so a bare sleep or a bare loop ignores the engine’s stop and is killed only after the engine’s own timeout, ten seconds later, every time a container is stopped or removed. So the loop traps the stop signal and leaves at once, and each sleep is put in the background and waited for, because a trap fires while the shell waits but not while it runs a child.

A shell loop rather than sleep infinity: sleep in the image is the one from coreutils, which takes infinity, but the loop is what every shell understands and it is the container’s whole purpose, so it is spelled out.