How are operating system containers different from virtual machines?

249 Views Asked by At

Everywhere I can see is how Docker can be different from virtual machine but nowhere there is a answer on how basic OS containers are different from virtual machine.

If we consider the basics, it looks like both are same i.e. an operating system is running within a operating system.

Would anybody explain the underlying difference?

1

There are 1 best solutions below

0
On

Virtual machines

Virtual machines use hardware virtualization. There is an additional layer between the original hardware and the virtual one, that the virtual machine thinks it's real.

This model doesn't reutilize anything from the host's OS. This way, you can run a Windows VM on a Linux host and vice-versa.

System Containers

Systems containers use operating-system-level virtualization. It reutilizes the host kernel from the host OS, and subdivide the real hardware directly to the containers. There isn't an additional layer to access the real hardware and, for this reason, the overhead (or loss of performance) is practically zero.

On the other hand, you can't run a Windows container inside a Linux host OS, since the kernel isn't the same.