VM vs Container
Cheat sheet · https://pcornel.dk/topic.php?topic=3418
Answer
A VM emulates a complete computer and boots its own OS and kernel, while a container is an isolated group of processes sharing the host's kernel. Containers are lighter and start faster; VMs give stronger isolation and can run a different OS.
Remember
- VMs normally have separate guest kernels; containers normally share the host kernel.
- A container image is not a VM disk image and a container is not simply a small VM.
- Containers still need an underlying host, which itself may be a VM.
- Some products use hypervisor-isolated containers, so implementation can combine both models.
First checks
systemd-detect-virt— VM or container?docker info | grep -i isolation— container isolation (Windows)cat /proc/1/cgroup— container cgroups
Verify in this order
VM: hardware → hypervisor → guest kernel; container: host kernel → namespaces/cgroups
Where it usually breaks
First mismatch in management intent → host/cluster capability → hypervisor runtime/task → virtual resource/device → guest state → workload-visible read-back; preserve identity/native error/pre-state before mutation.
Virtualization Fundamentals → VM vs Container reference map
| Boundary | Meaning | Evidence limit |
|---|---|---|
| Kernel | VM normally has guest kernel | Container normally shares host kernel |
| Hardware abstraction | VM gets virtual hardware | Container gets process/OS isolation |
| Startup/footprint | VM usually heavier | Container usually lighter but platform-dependent |
| Isolation | Hypervisor machine boundary | Kernel isolation boundary unless hypervisor-isolated |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3418