Containers vs virtual machines
Why a container is lighter than a VM.
To see what a container really is, compare it with a virtual machine. A VM uses a hypervisor to virtualize hardware, and on top of that virtual hardware runs a complete guest operating system — its own kernel, its own init, its own everything. That is heavy but strongly isolated: each VM is a full, separate computer. A container skips all of that. It virtualizes the operating system instead of the hardware, so every container on a host shares that one host kernel and ships only the files the app itself needs.
What sharing the kernel buys you
Because there is no guest OS to boot, a container starts in well under a second where a VM takes tens of seconds to minutes. It measures in megabytes, not gigabytes, so a single host that might run a handful of VMs can run dozens or hundreds of containers. That density and speed are exactly why containers became the unit of modern deployment and the thing Kubernetes schedules.
The tradeoff
Sharing the kernel is also the catch. Two VMs are separated by a hardware boundary; two containers are separated only by kernel features (namespaces and cgroups, which you will meet later). That boundary is strong enough for most workloads but thinner than a VM’s, which is the entire reason container hardening exists. And because they share the kernel, Linux containers need a Linux kernel — on macOS and Windows, Docker quietly runs them inside a small Linux VM.