Virtual machine - virtualise hardware
Container - virtualise operating system
| VMs | Containers |
|---|---|
| Heavyweight (full OS) | Lightweight (shared os) |
| Run its own OS | Share the host OS |
| Hardware virtualisation | OS virtualisation |
| Long startup time | Short startup time |
| Committed required memory | Used as needed |
| Machine-level isolation (more secure) | Process-level isolation (possibly less secure) |
Advantages:
Disadvantages:
Advantages:
Disadvantages:
Isolated area of an OS with resource usage limits applied
In Linux, use kernel building blocks:
namespaces
control group (or
cgroups)
Containers are OS-level virtualisation, not specific to Linux.
There are other implementations of containers, for example
chroot - https://en.wikipedia.org/wiki/ChrootLXC - https://en.wikipedia.org/wiki/LXCFreeBSD jail - https://en.wikipedia.org/wiki/FreeBSD_jailSolaris Containers - https://en.wikipedia.org/wiki/Solaris_ContainersDocker
Linux - Docker for Linux
macOS - Docker Desktop for Mac
Windows - Docker Desktop for Windows
docker then followed by a
subcommanddocker --helpdocker versiondocker system infoimagecontainervolumenetwork