One of the most interesting terms in virtualization that is appeared recently is containers. The containers offering a new layer of virtualization that are fit for packaging application. This type of virtualization allows to quickly build and deploy a large number of hosts or containers in a very short time and saves lots of time and money as compared to installing and deploying physical servers.
Virtual machine ( VM ) have been around for a few years from now while containers are new as an alternative solution to VM. If you are familiar with containers and Docker platform, we want to talk about some basic distinction of VMs and containers. In the following, there are top five difference between VMs and Containers.
1. Containers and VMs differ in OS & hardware implementation
VM uses complete OS and a slice of hardware resources: Hypervisor allows creating VMs with different OS images utilizing a slice of CPU, memory and network resources of the hypervisor.
Containers have to be OS same OS as its hosting server. Containers use a parent OS kernel & read-only copy of parent OS bin/lib files. Hardware resources are shared among the containers on a server.
2. Containers and VM has huge difference in size
VM runs the complete OS and its image can run in multi GB in size because containers inherit kernel, bin, and lib from hosts server, they are just few MB in size.
3. VMs are slower to boot, containers are almost instant
VMs boot up like any other machine and takes time to initialize OS services and hardware. Containers are ready to use and can be brought into existence almost instantly.
4. VMs provide the complete isolated environment, Containers are no so isolated
VMs with their own OS provide complete application isolation from other VMs on the same hypervisor. Containers sharing the same OS as a server do not provide complete application isolated environment.
5. Containers are easy to maintain
Each VM needs individual patching and OS updates while the containers sharing the common OS needs just parent OS updated to reflect in all containers.