What is the conceptual difference between a Virtual Machine and a Container, focusing on the OS mechanisms like Namespaces and Cgroups that enable containerization?
Last updated
A VM virtualizes hardware via a hypervisor and boots a full guest OS with its own kernel. This gives strong isolation but is heavier and slower to start.
A container virtualizes the OS: it is just isolated processes sharing the host kernel. It is lightweight and starts in milliseconds, but the shared kernel weakens isolation.
Namespaces isolate what a process sees (PID, network, mount, UTS, IPC, user). Cgroups limit and account the CPU, memory, and I/O it can use.