2

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?

halfer
  • 19,824
  • 17
  • 99
  • 186
Nikhil Agrawal
  • 26,128
  • 21
  • 90
  • 126
  • The most important difference is that a virtual machine is exactly what is sounds like, a virtual *machine*. The OS and programs running on a VM really thinks it's on its own hardware, its own "machine". A container is not its own "machine", it doesn't present itself as a unique and standalone computer. – Some programmer dude Sep 13 '17 at 07:13
  • @Someprogrammerdude So conatiners knows that they are part of a single OS and they have single set of hardware, In case of VM's they will like stand alone application. Are there any other differences? and what are the impacts of the first difference on the architecture of a application? – Nikhil Agrawal Sep 13 '17 at 07:20
  • Please mark the answer as correct if you are satisfied with it. :) – Paulo Coghi Feb 05 '18 at 18:20

1 Answers1

2

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.

Paulo Coghi
  • 13,724
  • 14
  • 68
  • 90