Module F-1·25 min read

Why containers are not VMs, Linux namespaces, cgroups, and the layered OverlayFS system.

JJS
Written by Jatin Jain Saraf · Senior Software Engineer

Introduction

When most developers start learning Docker, they memorize a few commands: docker run, docker stop, docker ps. They treat Docker as a black box—a magic technology that somehow runs an application on any computer exactly the same way.

Many developers assume Docker is just a lightweight Virtual Machine (VM). This mental model works when you're just starting, but it completely breaks down in production. When you need to debug a container that's silently crashing due to an Out of Memory (OOM) error, or figure out why your container has no internet access, the "lightweight VM" model is useless.

In this module, we are going to look under the hood. We will unpack the "container illusion" and look at the actual Linux primitives that make Docker possible. By the end of this module, you will understand exactly what a container is (and isn't).


The Virtual Machine vs. Container Mental Model

Let's start by addressing the most common misconception.

The Virtual Machine Model

A Virtual Machine provides hardware-level virtualization. When you run a VM (like VirtualBox or VMware), a piece of software called a Hypervisor creates virtualized hardware—a fake CPU, fake memory, a fake hard drive, and a fake network card.

You then install a complete Guest Operating System (like Ubuntu or Windows) onto this fake hardware. The Guest OS boots up, loads its own kernel into memory, and then runs your application.

The Container Model

Containers do not virtualize hardware. They do not run a Guest Operating System. A container is just a normal Linux process.

When you run a Docker container, you are asking the Linux kernel on your host machine to run a standard process, but you are asking the kernel to lie to that process. The kernel puts up walls around the process so it thinks it is alone on the system.

Because a container is just a process, it has almost zero overhead. It starts in milliseconds, just like running node server.js locally.

Architecture Comparison

text

This brings us to a fundamental rule of containers:

[!IMPORTANT] Containers share the host's Linux Kernel. If you are running Docker on an Ubuntu host, all your containers are executing system calls directly against that Ubuntu kernel. You cannot run a Windows container on a Linux kernel, because a Windows application needs a Windows kernel to understand its system calls.

Sign in to keep reading

The rest of this module is free — sign in with Google to unlock it and track your progress.

Sign in & Register

Discussion

0

Join the discussion

Loading comments...

© 2026 Jatin Jain Saraf (JJS). All rights reserved.