Understanding Container Virtualization


Hello again; this time our topic is going to be a bit in-depth regarding virtualization. Previously we learned how we could host Virtual Machines on a hypervisor and provide those machines with parts of our hardware so they could run independently. But even on these machines we can make even more isolated environments. These isolated environments within a " Hypervisor's" Virtual Machines are called containers. Containers are the next step towards virtualization. They work on the same principle of Isolation as the Virtual Machines.

How do they work?

Well a container works by isolating an environment within the kernel of an Operating System. They literally take a little part of the kernel of an existing operating system and isolate it. A container as the name suggests is merely a containment of a certain part of an existing OS's kernel. But one question arises.

What is a kernel?

Every working operating system has two basic privilege layers. The core and the foundational layer is called the Kernel layer and the visible layer is the user layer. The user layer does not directly get access to your computer's hardware for it is too risky. Let me explain with an example.

Suppose that you have an application that needs to create a new file and store it. It has no privilege to do so as it is restricted to do so. So, for this process to occur, the application sends a request to the kernel layer; the kernel reads it and carries out this process. But a new question arises.

What are the privileges of a kernel?

The kernel layer has absolute and complete access to your computer's hardware like, your RAM, CPU, GPU, etc. Because we can simply never give such permissions to normal applications on the user layer, every application must go through this request process in the kernel layer. Now the fact is the internet is a dangerous place. You might download software thinking it would be normal, but for a normal user, they can not spot malware or viruses in files.

Access Control

Even experts can't. Which means that if your software was given direct access to the memory it would be dangerous for your own device and your privacy. Not only that, suppose someone hacks that software and plants a virus in it; you simply would update it, but, unintentionally, your own software would become the reason for your demise.

Now I could go on and on about the dangers of giving unrestricted access to normal applications on a user layer. I believe I have explained enough for the reader; you should now be able to contemplate other outcomes of these permissions.

But nonetheless coming back to our topic, the kernel is basically the part of the operating system which directly speaks with your physical hardware and manages it.

What does it contain?

A kernel contains the foundational programs for an Operating System to fully operate and be able to communicate with the hardware. Without a kernel and operating system is a mere program without its proper syntax. It is useless and needless. Kernel is the core of an Operating System.


Why does it matter?

The kernel is important for our containers because a container exists by isolating a certain part of that kernel. Another thing which I would like to bring to your attention is the fact that you can only create the container of the same operating system. As the kernel is used, you cannot make a Linux container on a Windows Operating System.

Also Read: Why One Physical Server Can Run Multiple Virtual Machines

Containers

Containers are fast-paced, with barely any downloading, as they are isolated in the kernel of the Operating System. So you can make a Windows container on a Windows OS within seconds. It is like making a Virtual Machine but without having to download the disc image and completely avoiding any kind of downloading. While containers are very brilliant for running servers, the thing is they can not be used for heavy testing like we did in the case of the Virtual Machines.

The fact that they do not offer such features is because they are not as isolated as a Virtual Machine. Because of them being directly in the kernel we can expect massive troubles if we start testing malware or software in containers.

Docker

Like we use a hypervisor as software to run Virtual Machines, in the case of containers, the most commonly used platform is called Docker. Making a container through docker is very easy and straightforward due to the fact that this is the whole purpose of a container. But again, we can not forget that each container can only be made if it is the same Operating System as the Operating System we are using on our machine natively.

So we can not expect to make a Linux Operating System on a Windows Operating system because when the docker will utilize the kernel of our main operating system, we will not be able to run it. We are using the Windows Operating System with its own kernel, so Linux has no kernel to isolate and will not work.

Containers on a Virtual Machine

This issue can be resolved by using a Virtual Machine. Without having to use new machines, we can just create a huge number of Virtual Machines with our required Operating System, and then we can simply create a container through the software called Docker. It is like filling the rooms on each floor of that apartment I discussed in my previous article about virtualization.

Conclusion

Containers are fast paced, easy to create and delete and run. The whole reason why massive giants are using containers to squeeze out even the smallest room they can. Cost efficiency becomes highly achievable through containers.

  • They gather the application and its dependencies.

  • They share the host’s operating system, by its kernel so they start very fast.

  • They remain isolated from each other, so a corrupted container does not affect the others.

  • They can run basically on any machine and are decent for testing but great for deployment.

I am very thankful for those who read till now. I am Abdullah Zahid, and I will see you in another article.

Post a Comment

0 Comments