A python file("hw1.py") runs well on my laptop.
But what if it does not on my friend's?
➡ ModuleNotFoundError: No Module named 'xgboost'
➡ The module isn't installed in his laptob
Plus, what if there's a one who hasn't installed a Python?
What if there's a one with Python 2.10 ..?
It is a headache to configure your environment for different versions of software a on single machine.
"Let's make our program run on every environtment!"
Virtualization, as the name implies, is the creation of a virtual version of something, such as an OS, a server or a storage device.
It creates a simulated computing environment that is abstracted from the physical computing hardware.
Then the software simulates hardware functionallity.
There are 2 types of virtualization. Let's see what are the differences.
✌ Hardware-level virtualization
A virtual machine is a system which acts exactly like a computer.
Each virtual machine requires its own underlying operating system, and then the hardware is virtualized.
Virtual mahicne takes up a lot of resouces because each VM runs a virtual copy of all the HW that the OS needs to run.
Hypervisor:
A layer that runs on the physical host and interacts with both the host machine and the VM.
It abstracts the host computer's resources to VM.
Thanks to the hypervisor, the hardware resources are virtualized and each VM is isolated from each other.
✌ OS-level virtualizaition
Containers are a layer of abstraction above both pyhiscal machines and VMs. It sits on top of them.
While a VM abstracts a complete machine, a container only abstracts an application and its dependences.
While a VM has its own guest OS above the host OS, which makes VM heavy, a container share the host OS.
Docker is a OS-level virtualization software.
It is designed to make it easier for developers to develop, ship, and run applications by using containers.
As we mentioned above, containers are isolated from one another and bundle their own software, libraries and configuration files.
They can communicate with each other through well-defined channels.
Thanks to 2 isolation techonologies on linux kernel.
1) Namespace: a feature for partitioning kernel resources
2) Control group(cgroup): a feature for limiting and isolating resource usage(CPU, memorym, network ..) of a collection of processes.
Docker Image is a read-only templates containing instructions for creating a container.
Then a docker container is a running image instance. You can create many containers from same image, each with its own unique data and state.
(You can think of the left as an Image and the right as a Container! yummy Boongeobbang ;-))
image)
https://en.wikipedia.org/wiki/Docker_(software)
https://bikramat.medium.com/namespace-vs-cgroup-60c832c6b8c8