Why Container Virtualization?
In order to understand why we really need a container virtualization (ex: Docker) we need to understand the evolution of virtualization.
In the pre-virtualization days we used big server racks with host operating system in it and each physical server only ran a single application.
- Cost: There needs to be physical machine per each application with a huge-cost factor.
- Slow Deployment: The process of purchasing and on boarding physical servers are painful and result in slow deployment.
- Hard to Migrate: There is a significant amount of configuration changes and lot of manual intervention to migrate to a different physical machine.
Hypervisor-based virtualization has a new layer called “Hypervisor “added on top of the Host Operating System. A Hypervisor can add multiple VM’s(Virtual machines) on a host machine. Each VM can run a different set of Guest Operating System resulting in each Guest operating system running an application.
What is Hypervisor? A Hypervisor or virtual machine monitor (VMM) is computer software, firmware, or hardware, that creates and runs virtual machines(Wiki Definition).
VMWare and VirtualBox are popular Hypervisors.
Physical Machine on-boarding can still be avoided by using Cloud Providers ex: AWS, Azure etc.
- Cost-Efficient: Each physical machine is divided into multiple VM’s which is cost effective.
- East to scale: With VM’s deployed in cloud environment, It is easy to scale based on the requirement and it is not required to order and configure physical machines. More VM’s can be added/configured just with a “push button”.
- Kernel Resource Duplication: Each VM still needs to have a separate Operating system installed(with device drivers etc).
- Portability issue: There is still lot of work to port to a different VM.
On top of a machine( Physical machine/ Virtual machine), There is a Operating System installed which internally has a “Container Engine”, A container engine is capable to run different application’s in different container’s.Docker is one of the implementation of Container-based virtualization
Hypervisor vs Container: Hypervisor run’s each application in a separate Kernel and virtualization happens at hardware level. Container uses the host kernel and virtualization happens on the host operating system.
- Runtime Isolation: Isolate different runtime environments based on the application requirement. Let’s say application-a requires a JRE8 and application-b requires JRE7, Both the applications can be deployed in a different container in a single virtual machine which provides a application level runtime isolation.
- Cost-Efficient: Container based virtualization does not create a entire virtual Operating system and Containers consume less CPU/RAM or storage space than VM’s.
- Faster Deployment: Containers are very fast to boot/configure.
- Guaranteed Portability: Containers are portable.