Choosing between them.
WHAT A VIRTUAL MACHINE PROVIDES
A complete operating system, with its own kernel Strong isolation The ability to run a different operating system
WHAT IT COSTS
Gigabytes of memory and disk each Startup measured in tens of seconds Patching an operating system per machine
WHAT A CONTAINER PROVIDES
Isolation of a process Startup in under a second
Density: many on one host
A single artefact carrying its dependencies
WHAT IT COSTS
A shared kernel, so isolation is weaker Only the host's operating system family
WHAT THAT LAST POINT MEANS PRACTICALLY
Linux containers need a Linux kernel, whatever your desktop runs.
WHAT HAPPENS ON OTHER DESKTOPS
A virtual machine runs quietly underneath.
WHY THAT MATTERS
It explains performance differences developers notice.
WHEN TO PREFER VIRTUAL MACHINES
Strong isolation between untrusted parties Running different operating systems Legacy software expecting a full machine
WHEN TO PREFER CONTAINERS
Packaging your own applications Consistency across environments Many small services
WHAT IS COMMON IN PRACTICE
Containers running on virtual machines.
WHY THAT IS NOT WASTEFUL
The virtual machine provides the isolation boundary; containers provide packaging.