Where do you find a container's memory limit on the host?
IntermediateConceptContainers, VMs & Isolation Internals
Answer
In its cgroup directory. With cgroups v2 and the systemd driver:
ID=$(docker inspect -f '{{.Id}}' web)
cat /sys/fs/cgroup/system.slice/docker-$ID.scope/memory.max
cat /sys/fs/cgroup/system.slice/docker-$ID.scope/memory.current
max means unlimited. Inside the container, /sys/fs/cgroup/memory.max shows the same value.
More on Containers, VMs & Isolation Internals
What is a container, in one sentence?BeginnerHow do containers differ from virtual machines?BeginnerCan a Linux container run a Windows application, or the reverse?IntermediateWhat are Linux namespaces? Name the ones Docker uses.BeginnerWhat are cgroups and what do they do for containers?BeginnerWhat is PID 1 in a container and why does it matter?Intermediate