What's the Difference Between VM and Containers


* hypervisor is responsible for creating virtualized instances of each of the components that make up our machines (processors, ram, storage, network)
* kernel helps software and hardware talk to each other (manage applications and hardware resources)
* Host OS is hosting all of our containers


The level at which virtualization happens

The technologies of virtual machine and container are different ways of achieving virtualization. Virtual machine is "hardware virtualization" because it happens at the hardware level.Container is "operating system level virtualization" because it happens at the operating system level.


The type of isolation that we're achieving

With virtual machines we're achieving isolation of machines. If we can imagine at our base layer, we have one server. But we want to take our resources and split them up so that we're getting much more use out of what we have.

Whereas with containers, we're dealing with process isolation. They're sharing the same operating system, same kernel. But it's appearing to each container as if they have their own operating system.


Different in portability and flexibility

With virtual machine, we have infinite flexibility of hardware because we're making a different machine out of our server.

Whereas with container, we have infinite portability because we have our container that's being defined in a single file (Docker file). We can take one file and be able to make it run wherever.


Reference

https://youtu.be/cjXI-yxqGTI