Card 02/ 05
All 5 cards
ComparisonDifficulty: Beginner1 min
A Container Beside a Virtual Machine
Both hand you something that behaves like its own machine. They buy it differently, and the difference is what decides which one you want.
| Compared on | Container | Virtual machine |
|---|---|---|
| What starts | A process | A kernel, then an init system, then your process |
| How long | Milliseconds | Tens of seconds |
| What separates it | Kernel features, on a shared kernel | A boundary drawn in hardware |
| Can run another OS | No, the kernel is the host's | Yes |
Reach for a container when you want the Linux you already have, packaged so it runs the same on someone else's machine. Reach for a virtual machine when you need a different kernel, or a boundary strong enough to put someone you do not trust behind.