VMs | Container |
When you run three VMs on a host, you have three completely separate operating systems running on and sharing the same bare-metal hardware. Underneath those VMs is the host’s OS and a hypervisor, which divides the physical hardware resources into smaller sets of virtual resources that can be used by the operating system inside each VMs. | Containers, on the other hand, all perform system calls on the exact same kernel running in the host OS. The CPU doesn’t need to do any kind of virtualization the way it does with VMs |
Full isolation - because each VM runs its own Linux kernel. | Containers all call out to the same kernel, which can clearly pose a security risk. |
If you have a limited amount of hardware resources, VMs may only be an option when you have a small number of processes that you want to isolate. | To run greater numbers of isolated processes on the same machine, containers are a much better choice because of their low overhead. |