Virtual Machine and Containers are both techniques for virtualization and in many scenario either can be used. Though Virtual Machine and Container are similar in many ways, they both have there own space and can coexist in the same ecosystem.
Virtual Machines utilize a concept called “Virtualization” to utilize resources on a machine to create one or virtual machines running its own operating systems. The primary machine is often referred as “Host” and virtual machines as “Guest”. These virtual machines are created by the virtualization software like VirtualBox
by intercepting access to certain hardware components and certain features from the host machine.
Containers utilize operating-system-level
virtualization method. It requires OS kernel support which allows multiple isolated user space instances sharing host operating system resources. These instances are often called containers. LXC
provides container support for Linux and very recently Microsoft announces container support for Windows ecosystem via Windows Server Containers. Docker
is an open platform to build, ship, and run distributed applications as containers.
Though Virtual Machine and Containers are both virtualization techniques they differ significantly both technically and ideologically.
VMs replicate the OS kernels for each guest and often require hardware support from host machine. In container environments, guests are isolated like virtual machines using more lightweight mechanisms around Linux processes instead.
* Image Source: http://www.docker.com
As you can see in the above diagram the guest OS ships with each VMs making it cumbersome and hard to transport. With containers, Docker Engine runs as a Linux process and manages all the containers which are light weight as they only contains application and its dependencies.
Now let’s see how VMs and containers stand against each other:
Thank you for reading my article, please leave valuable feedback. If you liked this article would like to see more, please click the Yes button near the: Was this article helpful? at the bottom of this article just below and to the right of this information.
I look forward to hearing from you. - Gautam- twitter @gksinghiet