podman pause
is listed as "pause a container" in --help
, while podman stop
is listed as "stop a container" what's the difference between these two commands?
1 Answer
This functionality is left to the ContainerEngine for implementation.
Pause is suspend
Pause does some voodoo with freezing cgroups you can see this in the code to crun
in libcrun_cgroup_pause_unpause_with_mode
(which handles pause and unpause). Tasks do not know when they're frozen it happens in the kernel, according to the docs on cgroup v1's freeze,
In contrast, the cgroup freezer uses the kernel freezer code to prevent the freeze/unfreeze cycle from becoming visible to the tasks being frozen. This allows the bash example above and gdb to run as expected.
Pause set the container's cgroup status to thawed, freezing, or frozen.
Stop kills
Stop will send SIGKILL
or SIGINT
depending on if there is a timeout. This functionality is not in crun
but in podman
(confirmed by checking man crun
and in source).