When comparing containers with VMs, here are the major differences:
- Virtual machines are an emulation of an entire computer system (full virtualization), including emulated hardware. This means users can interact with emulated, virtual hardware such as a network card, graphics adapter, CPUs, memory, and disks.
- Virtual Machines use more resources because they are hardware virtualization, or full virtualization, as opposed to containers, which are virtualized at the operating system (OS) level.
- Processes inside a container are run directly on the host machine’s kernel. Multiple containers on the same machine would all shares the host’s kernel. In contrast, processes inside a VM runs on the VM's own virtual kernel and OS.
- Processes which run inside a container are isolated by namespaces and control group. Processes running inside a VM are separated by the emulated hardware.