Hands-on task
Docker from the inside: where a container's limits live
The team is arguing: does docker run --memory really limit anything, or is it just a note in the container's metadata? Check it at the kernel level.
- Start a container
apifrom thebusybox:1.36image with the commandsleep infinity, a memory limit of 128 MiB (128m) and half a core of CPU. - Find the cgroup directory on the server where Docker put the container, and write its full path (starting with
/sys/fs/cgroup) to/root/api-cgroup.txt. - Find the number of the container's network namespace — as
lsnsshows it, for example4026532301— and write it to/root/api-netns.txt.
Look into the limit files of the group you found: what's written there settles the argument.
- docker
- cgroups
- namespaces
- lsns