Containerization vs Virtualization
Containers are lightweight, portable running instances of docker image that contain all of your code and its dependencies. It helps the software to run on any machine without worrying about the configuration on production servers. Virtualization refers to the virtual division of hardware (CPU, Memory) of a bare metal computer/server by the hypervisor (VM box) which makes it look like there are separate machines on a single bare metal hardware.
It must be sounding like too much of a jargon, let’s dive into this topic. But before that let’s look at the picture and imagine the division of hardware.
Virtualization
- Usually, a computer/bare metal server comes with a CPU, RAM (Memory), Storage, and NIC.
- When a bare metal comes with a hypervisor it allows us to virtually divide the bare metal into multiple computers or virtual machines which are isolated and can function independently without any interference with each other despite running on the same bare metal hardware.
- Hypervisor is meant to run different OS and Kernels on the same system hardware. Irrespective of the bare metal OS kernel (Windows, Linux, or Mac) the hypervisor can install different versions of Linux-based kernel, Windows-based kernel, and OS inside different Virtual machines separately.
Containerization
- When we talk about Containerization, it does not include a hypervisor instead it has a docker engine that allows multiple containers to run on a single machine. Containers are also isolated but they can talk with each other with the help of docker network which is an internal functionality of docker.
- Containers use the host’s operating system Kernel (mostly Linux), it’s like if the Host OS Kernel is Ubuntu (Linux), then the container engine installed on the machine will help the container use the Kernel to talk to the Computer/Server hardware. Docker then can run any flavor of OS container on top of it as long as the docker container is based on the same Kernel.
- We cannot run a Container based on Windows kernel, for that we need the Host OS to be Windows-based.
- Docker’s main job is to package software and dependencies into a docker file —> Docker Image —-> Docker Container. Which are run on the Docker engine of any OS kernel provided the docker containers are also based on the same OS kernel (Linux, Windows, or Mac)
If Linux based Container can runs on the same Host OS Kernel, then how can we run the Linux based container inside of the Windows laptops?
That is actually a very logical and counter-argument question to the theory explained above.
- Windows uses WSL (Windows Subsystem for Linux), a kind of software that puts up a Linux OS-based VM (Virtual Machine), and that VM is actually used to run the Linux-based container. Hence the principle remains the same, Windows is also running Linux based container on a Linux Host OS kernel
0 Comments