Pcornel
Virtualization · Virtualization Fundamentals

VM vs Container

Cheat sheet · https://pcornel.dk/topic.php?topic=3418

Back to the Topic

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

BoundaryMeaningEvidence limit
KernelVM normally has guest kernelContainer normally shares host kernel
Hardware abstractionVM gets virtual hardwareContainer gets process/OS isolation
Startup/footprintVM usually heavierContainer usually lighter but platform-dependent
IsolationHypervisor machine boundaryKernel 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

Confirmation

Confirm action

Continue?