Introduction to Docker

What is virtualization? Why docker? and other questions answered...

Introduction to Docker

Image link: https://developers.redhat.com/sites/default/files/styles/article_feature/public/blog/2014/05/homepage-docker-logo.png?itok=zx0e-vcP

Thank you https://www.youtube.com/@TechnicalGuftgu channel for an amazing session on Docker. I have tried to explain the main concepts in this blog. All the reference videos are highlighted at the end.

For learning docker first let's see some important concepts:


A] Virtualization

  • The technique of splitting physical resources into as many logical resources as you want.

  • Example- One device can be used by 2 or more people depending on the device configuration.

  • This increases utilization of the machine.

So the question arises why do we even need Virtualization?

In the first diagram, consider this is a normal system with 16GB RAM and other specifications. Now if you are using 4 GB of RAM regularly for your processes and applications and another 2GB for the O.S and other apps, then 10 GB Ram is still unused. This leads to the underutilization of resources.

In the case of virtualization, we can create virtual machines these VMs will be allocated memory and other resources from the hardware resources. i.e. if the hardware has 16 gb RAM then you can divide the RAM into the VMs. In this way, utilization is done efficiently. These VMs are isolated and independent of each other.

B] Hypervisor -

The hypervisor is a piece of software or firmware that creates and runs virtual machines. It is also known as a Virtual machine manager.

a. Type 1 hypervisor or Bare metal hypervisor: Hardware virtualization. Hypervisor runs directly on system hardware. A guest O.S runs on another level above hypervisor. Enterprise level.

b. Type 2 or Hosted type: O.S Virtualization. The hypervisor runs above the host operating system. For personal use. The virtualization can be done on your personal laptops.

Now lets understand why we need docker? You need to install operating system on these VMs they will take some memory. What if you want to create 10 VMs of 4gb RAM each and you have only 16GB ram in the hardware. Even if some Vms are idle for some time the memory and other resources that are allocated to them cannot be used elsewhere.

So to solve this problem Docker was introduced.


Docker

Architecture-

We can see that docker is installed on top of host O.S. Container takes up memory during runtime only. So now the 16 GB of RAM is not preallocated to the container, it will take up memory during runtime.

  • Docker is an open-source centralized platform designed to create, run, deploy applications

  • Uses container on host O.S to run applications. Allows applications to use the same Linux kernel as the system on the host computer rather than creating an O.S

  • We can install docker on any O.S but the docker engine runs natively on Linux distribution.

  • Performs O.S level virtualization.


Advantages of Docker:

  • No preallocation of RAM

  • Continuous Integration efficiency

  • Cost-effective

  • Lightweight

  • Can run on physical hardware, virtual h/w, or on the cloud

  • Reusable docker images

Disadvantages of docker

  • Not a good solution for an application that requires rich GUI

  • Difficult to manage large number of containers

  • Does not provide cross-platform compatibility. If container built on windows then it can't run on Linux

  • Docker is suitable when the development and testing environment is same. If dev container on Ubuntu and testing env on Cent O.S then although both O.S are derived from Unix, it is not possible to get the same env as the development.


References:

Virtualization, Hypervisor

Docker - https://youtu.be/vWjP3fsfgrw, https://youtu.be/vacvCaE4uQM, https://youtu.be/h17po-0DfWE

I will be sharing my next blog on Docker architecture.


That's it for this blog, If there are any suggestions, advice or concerns feel free to share!

https://www.linkedin.com/in/akshata-shenoy-04a108198/

Thank you for reading my blog.