Docker Mental Model: Namespaces vs Cgroups

Here's the mental model I wish I had when I started learning Docker. Not a diagram. A question. The question is: what changed? When you run a container, Linux creates a new set of answers to certain questions: What processes exist? What filesystems are mounted? What is the hostname? Before the container, those questions had the host's answers. After docker run, the process inside gets different answers. Same kernel. Different questions, different answers. The namespace is the mechanism that changes which answer the kernel returns. cgroups are completely separate. They don't change what the container sees. They change what the container is allowed to consume. Namespaces hide. cgroups limit. Most Docker mental models collapse these into one thing called "isolation." They're not the same, and knowing which one you need for which problem changes how you write Dockerfiles, configure orchestrators, and think about security. Not tutorials. Just a real picture. #Docker #Linux #DevOps #Containers #Infrastructure #CloudNative #SoftwareEngineering #MentalModel #OpenSource

To view or add a comment, sign in

Explore content categories