Expand description
Docker resource limits that must survive a resume (issue #176).
docker commit captures a container’s filesystem and image config, but not
its HostConfig. A snapshot-based resume ($ --resume <id> -- <cmd>) used to
start the replacement container without the memory, CPU and PIDs limits the
original one had — limits a supervisor typically applied with
docker update, so they were never part of the stored launch options.
This module reads the limits back out of docker inspect and translates the
non-default ones into docker run flags. The flags are kept in the
--flag=value form, so the same list is stored in the execution record,
shown in [Isolation] status lines, and spliced into docker run as is.
Constants§
- DEFAULT_
SHM_ SIZE - Docker’s default
/dev/shmsize; only a different size is re-applied.
Functions§
- build_
resource_ limits_ status_ line [Isolation]status line for resource limits, orNonewhen there are none.- cpu_
count - An existing quota/period cannot be changed to Docker NanoCPUs in place.
- cpu_
update_ args - format_
docker_ bytes - Format a byte count with the largest binary unit
docker runaccepts that represents it exactly (268435456→256m). - format_
docker_ cpus - Format
NanoCpusas the decimal--cpusvalue (500000000→0.5). - normalize_
resource_ limits - Normalize a stored
resourceLimitsvalue (array or whitespace-separated string) to a list of flags. - parse_
docker_ resource_ limits - Translate an inspected
HostConfigintodocker runflags. - read_
docker_ resource_ limits - Read a container’s resource limits with
docker inspect. - with_
cpu_ limit