AdvancedLesson 19 of 26
How containers really work
Namespaces isolate, cgroups limit, and layered filesystems stack.
A container is a normal Linux process with extra restrictions:
- Namespaces: give the process its own view of PIDs, network, mounts, hostname, users and IPC.
- cgroups: cap CPU, memory, I/O and process count.
- Union filesystems (overlayfs): stack read-only image layers with one writable layer on top.
- Capabilities and seccomp: restrict which privileged operations and system calls are allowed.
bash
docker run -d --name x sleep 1000
docker inspect -f '{{.State.Pid}}' x # the host PID of the container process
ps aux | grep "sleep 1000" # visible on the host (Linux)Docker is a friendly layer over these features; runtimes like containerd and runc do the work.