What are cgroups and what do they do for containers?
BeginnerConceptContainers, VMs & Isolation Internals
Answer
Control groups account for and limit resource usage (CPU, memory, I/O, PIDs) of a group of processes. Namespaces control what a process can see; cgroups control what it can use. docker run --memory=256m --cpus=1 just writes values into the container's cgroup.
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 is PID 1 in a container and why does it matter?IntermediateHow do you see which namespaces a container uses and enter them from the host?Intermediate