This tutorial will brief you the main differences between Containers and VMs (Virtual Machines). As you all know that containers have become a dominant technology term in Cloud native application development. So it is good to know to understand why containers become popular compared to VM’s.
What is a Virtual Machine (VM) ?
Virtual Machines (VMs) are the technology that is used to build virtualized computing environments. Virtualization technology has been there quite sometime and they are considered as the foundation for Cloud Computing in the beginning. In computing, a Virtual Machine (VM) is an emulation of a physical computer.
Using VMs you can run multiple machines with multiple OS on a single physical machine. And VM’s communicate with physical machines using lightweight software layers called Hypervisors. Hypervisors could separate VMs from each other and allocate resources separately for each of them.
What are Containers ?
Operating System Kernel allows the existence of multiple isolated user space instances. Such instances are called Containers (Docker). Containers are isolated from one another and bundle their own software, libraries and configuration files. Individual containers can communicate with each other through we-defined channels.
Containers are a light-weight, more agile way of handling virtualization. Instead of spinning up entire virtual machine with all the resources, a container just bundles their own software and required dependencies in one package as small piece of software.
In simpler terms, we can say containers uses OS-Level Virtualization to isolate the processes and control the processes’s access to resources.
Difference between Containers and VMs
In traditional virtualization, a hypervisor virtualizes physical hardware and each VM (Virtual Machine) contains guest OS, a virtual copy of hardware, an application and other associated dependencies and libraries. Instead of virtualizing the underlying hardware or infrastructure, containers uses OS-Level Virtualization, so each individual containers has it’s own application and its libraries and dependencies.
Containers are not just a file system, they always run with a command and this command run processes in isolation. This is classically known as linux containerization O-LXC (OS-level LinuX Containers) which is where the container originally comes from.
Containers Vs VMs
The following are the main differences or highlights about containers and VMs.
- You know starting a containers takes very less time when compared to VM’s. I would say starting a container is 300 times faster than starting a VM on a machine.
- Containers often runs single process, may contains children processes.
- Containers are lightweight compared to VM’s.
- VM’s are heavyweight when compared to Containers.
- Compared to VM images, container images are extremely easy to override and modify.
- Containers are small and fast compared to VM’s and portable.
- In case of VMs we are virtualizing the underlying infrastructure whereas containers uses OS-Level Virtualization.
- Like VM’s containers also allow you to improve resource utilization of your infrastructure. But containers can go beyond that with the utilization of microservices architectures.
- Create and Configure Virtual Machines on the VMware ESXi server
- Google Compute Engine Introduction and Features
- Docker: denied: requested access to the resource is denied
- Where the Docker images are stored locally?
- Event Driven Microservices: Spring Boot + Kubernetes + Docker + Helm + Google Cloud