<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Atulaman on Medium]]></title>
        <description><![CDATA[Stories by Atulaman on Medium]]></description>
        <link>https://medium.com/@atulaman65?source=rss-45258816cc41------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*uW8Ol20m-AHg6I-T</url>
            <title>Stories by Atulaman on Medium</title>
            <link>https://medium.com/@atulaman65?source=rss-45258816cc41------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 15:43:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@atulaman65/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Docker Namespaces — The Part Most Engineers Don’t Fully See]]></title>
            <link>https://medium.com/@atulaman65/docker-namespaces-the-part-most-engineers-dont-fully-see-e340d53c2238?source=rss-45258816cc41------2</link>
            <guid isPermaLink="false">https://medium.com/p/e340d53c2238</guid>
            <category><![CDATA[docker-namespace]]></category>
            <category><![CDATA[container-isolation]]></category>
            <category><![CDATA[containerization]]></category>
            <dc:creator><![CDATA[Atulaman]]></dc:creator>
            <pubDate>Sat, 21 Feb 2026 19:07:54 GMT</pubDate>
            <atom:updated>2026-02-21T19:07:54.551Z</atom:updated>
            <content:encoded><![CDATA[<p>Containers feel almost magical the first time you use Docker.</p><p>You run a simple command:</p><pre>docker run nginx</pre><p>…and suddenly you have something that looks and behaves like a separate machine.</p><p>Because of this, many developers naturally assume:</p><blockquote><em>“Containers are just lightweight virtual machines.”</em></blockquote><blockquote>They’re not.</blockquote><p>Under the hood, containers are simply <strong>regular Linux processes with carefully engineered isolation</strong>, primarily powered by two kernel features:</p><ul><li>Namespaces</li><li>Cgroups</li></ul><p>Once this mental model clicks, Docker becomes much easier to reason about — especially when debugging networking, security, or Kubernetes issues.</p><p>Let’s break it down step by step.</p><p><strong>Life Without Namespaces</strong></p><p>On a normal Linux system, processes share a single global view of the machine.</p><p>Every process can see:</p><ul><li>the same process tree</li><li>the same network stack</li><li>the same host name</li><li>the same file system view</li><li>the same user IDs</li></ul><p>This design works for general-purpose computing, but it creates problems at scale:</p><ul><li>Port conflicts</li><li>Dependency clashes</li><li>Security risks</li><li>Difficult multi-tenant isolation</li></ul><p>Before containers became mainstream, the typical solution was virtual machines — but they are heavy and slow to start.</p><p>Linux namespaces changed the game.</p><h3><strong>What Namespaces Actually Do</strong></h3><p>Namespaces are a Linux kernel feature that <strong>partitions global system resources into isolated views</strong>.</p><p>In simple terms:</p><blockquote><em>Processes inside different namespaces see different versions of the system.</em></blockquote><p>This is the core trick behind containers.</p><p>When Docker starts a container, it doesn’t boot a new OS. Instead, it:</p><ol><li>Creates new namespaces</li><li>Applies cgroup limits</li><li>Starts the container process inside those namespaces</li></ol><p>From inside the container, everything looks independent — but the host kernel is still shared.</p><h3><strong>The Key Namespaces Docker Uses</strong></h3><p>Each namespace isolates a specific aspect of the system.</p><h4>1. PID Namespace — Process Isolation</h4><p>The PID namespace gives each container its own process tree.</p><p>Inside the container:</p><ul><li>the main process appears as PID 1</li><li>only container processes are visible</li></ul><p>Outside the container, the host still sees the real PIDs.</p><p><strong>Why it matters:</strong></p><ul><li>prevents process snooping</li><li>enables clean process management</li><li>makes containers feel like separate systems</li></ul><h4>2. NET Namespace — Network Isolation</h4><p>The network namespace gives each container its own:</p><ul><li>network interfaces</li><li>IP address</li><li>routing table</li><li>port space</li></ul><p>This is why multiple containers can safely run services on the same internal port (like 80 or 5432).</p><p><strong>Why it matters:</strong></p><ul><li>avoids port conflicts</li><li>enables microservices</li><li>allows per-container networking</li></ul><h4><strong>3. MNT Namespace — Filesystem Isolation</strong></h4><p>The mount namespace isolates filesystem views.</p><p>Each container sees its own filesystem layout, even though it ultimately maps back to the host storage.</p><p>This enables:</p><ul><li>different library versions</li><li>image layering</li><li>safer file operations</li></ul><p><strong>Why it matters:</strong></p><ul><li>dependency isolation</li><li>reproducible environments</li><li>safer deployments</li></ul><h4>4. IPC Namespace — Inter-Process Communication</h4><p>This namespace isolates shared memory, semaphores, and message queues.</p><p>Without it, processes across containers could potentially interfere via shared IPC mechanisms.</p><p><strong>Why it matters:</strong></p><ul><li>prevents cross-container memory interference</li><li>improves isolation guarantees</li></ul><h4>5. UTS Namespace — Hostname Isolation</h4><p>UTS controls the hostname and domain name.</p><p>This is why each container can have its own hostname even though they run on the same host.</p><p><strong>Why it matters:</strong></p><ul><li>container identity</li><li>cleaner service discovery</li><li>better multi-tenant behavior</li></ul><h4>6. USER Namespace — UID/GID Isolation (Advanced)</h4><p>The user namespace maps container users to different host users.</p><p>For example:</p><ul><li>inside container → root (UID 0)</li><li>on host → unprivileged UID</li></ul><p>This significantly improves security but is not always enabled by default.</p><p><strong>Why it matters:</strong></p><ul><li>reduces container breakout risk</li><li>improves multi-tenant security</li></ul><h3>Where Cgroups Fit In</h3><p>Namespaces answer:</p><blockquote><em>“What can this container see?”</em></blockquote><p>Cgroups answer:</p><blockquote><em>“How much can this container use?”</em></blockquote><p>Cgroups limit and account for resource usage such as:</p><ul><li>CPU</li><li>Memory</li><li>Disk I/O</li><li>Network bandwidth</li></ul><p>Without cgroups, a single container could consume all host resources.</p><p>Together, namespaces + cgroups form the foundation of containers.</p><h3>The Surprising Part: Docker Isn’t Required</h3><p>One of the most eye-opening facts is that Docker did not invent containers.</p><p>Linux already provides native tools to work with namespaces directly:</p><pre>unshare   # create namespaces<br>nsenter   # enter namespaces<br>lsns      # list namespaces</pre><p>Docker is essentially a highly polished developer experience built on top of these kernel primitives.</p><p>This is also why low-level container runtimes (like runc) can exist independently of Docker.</p><h3>How Docker Works on macOS and Windows</h3><p>Here’s something many people don’t realize:</p><p><strong>Namespaces are Linux-only.</strong></p><p>So how does Docker work on macOS or Windows?</p><p>Docker Desktop quietly runs your containers inside a lightweight Linux virtual machine.</p><h3>On Windows</h3><p>Docker typically uses <strong>Windows Subsystem for Linux (WSL2)</strong>, which provides a real Linux kernel running inside Windows.</p><h3>On macOS</h3><p>Docker uses a lightweight VM powered by:</p><ul><li><strong>HyperKit</strong></li><li><strong>Apple Virtualization Framework</strong></li></ul><p>No matter the host OS, Linux containers always ultimately rely on the Linux kernel.</p><p>This is why container behavior and performance can differ slightly between Linux hosts and Docker Desktop environments.</p><h3>Final Takeaway</h3><p>Containers feel magical — but the mechanics are beautifully simple.</p><ul><li>Containers are not mini VMs</li><li>Containers are isolated processes</li><li>Namespaces provide isolation</li><li>Cgroups enforce resource limits</li><li>Docker is the developer-friendly layer on top</li></ul><p>Understanding this mental model makes it much easier to debug real-world container behavior, especially in modern cloud-native platforms.</p><p>And once you see containers this way, you can’t unsee it.</p><p><strong>#Docker #Linux #Containers #DevOps #CloudNative #Kubernetes #PlatformEngineering</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e340d53c2238" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>