How is a container different from a virtual machine?
Short answer
A virtual machine runs its own kernel on a hypervisor; a container is just a process on the host, sharing the kernel, isolated with namespaces and limited with cgroups. Much lighter and faster to start, but weaker isolation.
3 points to say:
- VM: own kernel, strong isolation, heavy (GB, tens of seconds to boot); container: MB, starts in milliseconds to seconds.
- A kernel vulnerability affects every container on the host; in practice containers run on VMs, and stronger isolation uses a sandbox.
- A JVM over the cgroup memory limit gets OOM killed, exit 137 (128 + SIGKILL).
Keep reading the deep dive
Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.