Post Thumbnail

Understanding Docker Images, Containers, Architecture and Their Role in Modern Development



What is Docker:

Docker is a tool which simplifies building, shipping and running applications. Building means creation of an application, shipping means movement of an application one pc to another pc and running this application on any other pc.

Docker is a software containerization platform. That means you can build your application, once the application is built, you can package that application with all dependency into a box called container, and once the container is built you can ship that container to any other machine in the world and your application will work perfectly in that machine without any external need. 

Docker Image vs Docker container:

Docker image is a read only file. It read only because once the Docker image is built we can’t modify it. Every Docker image contain some minimum set of files this minimum set of file are nothing but small part of operating system which is require to run Docker container.

Docker images are used to build Docker containers. When we run the Docker image with help of Docker run command it produces an output as a Docker container. Docker container is an instance of image. We can create any number of containers with the help of the same Docker image.

In oop concept Docker image is a class and container is an instance of this class.


Why We Use Docker:

Assume that we have computer with windows 10 install. We have created an application of software or you can download any software from internet. But the problem is this software we can’t install in window 10 pc, now how to run this software?

Let’s assume another example we have created a website with the PHP version 7. And this php7 installed globally in my computer. Now I have to create another website with the version of php8 but my pc already has installed php7 then how create website with php8? 

You can think I remove php7 and install php8 is it correct? No, if you remove php7 and install php8 after few days if you have to fix the bug of php7 version website then again need install php7. This is not correct way. Solving this problem, we have 2 options. Virtualization and containerization let’s try to understand Virtualization and containerization with the bellow diagram.

Virtualization: in the above diagram we have our main operating system. Top of the main operating system we have to install hypervisor. Top of the hypervisor we have multiple virtual machine and each virtual machine has different operating System. We can create many virtual machine top of the hypervisor and install required operating system to run required software.

The problem of Virtualization is each virtual machine can have one operation system. From above PHP example we need 2 virtual machine and 2 operating system installed on top of the VM. To solve this problem containerization is the best way

Containerization: in this containerization no need to setup multiple VM and multiple OS. Just install Docker. The above PHP example we can create php7 container and php8 container both php7 and php8 we can run same time with the help of Docker Container.

Docker Components: Docker has 3 components.

1.     Docker Client

2.     Rest API

3.     Docker Daemon 

Docker client send request to Docker daemon through Rest API. Docker daemon process request and send result back to Docker Client.


Docker Architecture: we will try to understand Docker Architecture with the help of bellow diagram.


Using Docker pull commend we can download any Docker image from internet but Docker is very smart. When we run Docker pull <nginx>. First Docker client going to Docker daemon. Docker daemon will check nginx image will exist in local repo if not exist it will download from internet and back to Docker client.

If second time if we run Docker pull <nignx>. The Docker daemon not download once again. It will server from local repo.

Read more about docker:

Dockerfile, Image Creation, Docker Compose, and Essential Docker Commands

Rasel Hasan

Rasel Hasan

I am a seasoned Senior Software Engineer with over 6 years of expertise, currently contributing my skills at Bijoytech IT Ltd. My proficiency spans a diverse range of domains, including e-commerce, POS, ERP, custom software, payment solutions, and more...

Know More