Caffeinated Coder
Book an appointment
Lesson 18 · Networking, scripting and internals

Namespaces and cgroups: how containers work

A container is not a second computer: it is ordinary processes on the one shared Linux kernel. The kernel gives them a private view with namespaces (their own process IDs, hostname and mounts) and a budget with control groups (cgroups). Build a tiny container by hand: unshare starts bash as PID 1 in new namespaces, then a cgroup caps its memory at 100 MiB and the OOM killer enforces it.

12 min12 steps5 questionsAdvanced
Fig 18 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.