To understand the difference between the containers and virtual machines, we must first understand the concept of Virtualization.
What is Virtualization?
Virtualization is technology that lets you create useful IT services and projects using resources that are traditionally bound to hardware. It is a process in which the normal computer resources like CPU, RAM, Disk Space, etc. can be "virtualized" and can be used as multiple resources.
Both Containers and VMs are virtualization tools.
What are containers?
If we discuss in short then, Containers are the technologies that allow you to package and isolate applications with their entire runtime environment—all of the files necessary to run.
Before containers, in any development process the developers had to install the packages and tools required in development at there respective machines. Since different machines have different OS, it creates a great scope of error and bugs in all these installations.
Containers solve these problems by creating an isolated environment with all these files and configurations and every developer can use this instance of software ( called as image ).
Difference between Container and VMs
To understand the difference between these two we should look how OS is framed;
Any Operating System has to layers above it's hardware; viz. OS Kernel Layer and Applications Layer. OS kernel interacts with hardware and applications are based on these kernel layers.
The key difference between Containers and VMs is that a Container Environment virtualizes the Applications Layer whereas the VMs virtualize the Applications Layer + OS Kernel layer
This means that VMs virtualize the complete operating system. Thus when we setup the VM then it did not use host's OS kernel, it boots up on it's own.
KEY DIFFERENCES
Containers are smaller in size as they just virtualize the applications layer while the VMs are big in size, generally few gigabytes.
Second is speed, we can run the containers pretty quickly as compared to VM, because they every time you start them, have to put the operating system kernel and the applications on top of it.
The third difference is compatibility, so you can run a virtual machine image of any operating system on any other operating system host, but you can't do that with Containers.
That's it! This was the short and sweet look at the key differences between a container and a virtual machine.
To learn more, I have pinned some great articles here!
a. https://www.atlassian.com/microservices/cloud-computing/containers-vs-vms
b. https://www.redhat.com/en/topics/containers/containers-vs-vms
c. https://www.redhat.com/en/topics/containers
d. https://www.redhat.com/en/topics/virtualization/what-is-a-virtual-machine
Top comments (2)
Nicely done :) There is of course the old adage about the creation of containers:
Dev1: "Well it runs on my computer"
Dev2: "OK, then let's ship your computer"
😁
Thank!