What is Docker for containerization & How it Works

What is docker for: This is a platform as a service (PAAS). But it is use for developing and deploying the application/software in the container. So, this process is known as Containerization.

Finally we have found the exact thing (what is docker for) which we are looking. Because here in this article, I will provide you the complete detail about containerization process.

When you read this complete article. After that you will not need to look any more information.

This is the best article for absolute beginner and the intermediate level. So, now let’s get started.

Definition: What is Docker

Nowadays, we can notice that everywhere this is being used. Because of its light weight, secure, portable and easy to use. So it has start becoming common for everyone in the software engineering field. Similarly it helps a lot in developing more salient features.

It is obvious for everyone, who heard this term. Then he start searching about it.

Docker is a service that is known as Platform As A Services (Paas). Developer use this Platform As A Service (Paas). To develop, build, test & deploy the application in the container.

Container: It is an isolated environment. Which contain packages like- OS, Web Server, MySql, Etc which helps to run application. It also contain the file system snapshot with default commands. So commands could be use to modify the container later.

When container is used to develop & deploy any application/software. Then this process is known as containerization.

Benefits of Containerization

  • Lightweight: The size of the container really is very less.
  • Portable: After creating container, After that It will run on all platform.
  • Scalable: When it need, we can scale it anytime without any hassle.
  • Secure: This is more secure , because of its isolated environment.
  • Etc

Difference b/w Virtualization and Containerization

Virtualization: For creating virtualization.

Firstly we have to install virtualization software (like VMware, Esxi, Etc) on our operating system.

Then open the virtualization software. And create a new VM (Virtual Machine). After that provide the details of the resources like= RAM: 2GB, HDD: 100GB, etc.

In addition to create a new VM (Virtual Machine). Every time we have to install a new operating system.

When we create a new VM (Virtual Machine). Then every time we have to install a new operating system. This is the major drawback of virtualization. To overcome this issue containerization came into existence.

Containerization: For creating containerization.

Firstly we have to install docker on our operating system.

Then we can create any number of container so that we can run our application.

In addition to create a new container we do not need to install a new operating system.

This is the major factor in getting famous a container. That’s why it is mostly used by everyone in software engineering field.

What is Docker for and How it Works


Docker Life Cycle

Docker Hub:

This is an online service for searching, managing, and sharing the Docker Images.

But the (Pull and Push) command are use for images. To download and upload from docker hub.

Pull command is used for downloading the Image to our local system from Docker Hub.

docker pull image-name

Push command is used for uploading the Image to Docker Hub from our local system.

docker push image-name

Docker Image:

This is a light weight executable package or template of software. Which contain set of rules or instruction for creating the container

Firstly, after downloading the Image. We will run this by using the command

docker run image-name

When the run command will execute then new container of that image will create.

So for creating new container, Run command should be execute


This is an isolated environment. It contain file system snapshot with default commands. After that your application can run in the container.

Now we can modify this container by entering inside the container. By using the command.

docker exec -it container-Id bash

When your container is ready and you want to come outside from container. Then by using the exit command you will be outside the container.


Create Docker Image:

After exiting from the container. Then we will create a new image of that container by using the below command.

docker commit container-Id  provide_name_of_image

Now a new docker image will be create. And after that, now we have to push this image to Docker Hub by using the below command.

docker push login_username/name_of_image

What is Dockerfile & how it works

This is use to create custom image.

If we want an image which is containing an operating system and a web server. So for creating this image we have to use Dockerfile.

Create and Save Dockerfile

This file should write in YAML. After that the name of the file should always be save by the name of Dockerfile with always capital D.

Most importantly the Dockerfile file should contain multiple commands. So that we can create custom images.

Dockerfile commands:

  • FROM: Initialize a new build image and set the base image.
  • ADD: It is use to add a file to a particular location in the docker image.
  • RUN: This will execute the command on the docker image.
  • CMD: Execute at the start of the container.
  • ENTERYPOINT: Always execute at the run time of the container.
  • ENV: Used to create environment variables.

Command to Run Dockerfile

docker build provide_build_location -t provide_any_name

And example: docker build /home/xyz/ -t App1

But using Dockerfile we can create a single container at one time.

When we need to create multiple containers at one time so for that we have to use Docker compose

Docker Compose & how it works

This is a tool for creating and running multiple containers at one time.

Therefore the file should be write in YAML.

So, it will be containing multiple commands for creating multiple containers.

And the file will be save by the name using docker-compose.yml

However only single command will be use to start, and stop the multiple containers.

And Example:

When Starting Multi-containers by a single command

Docker Compose up

When Stopping Multi-containers by a single command

Docker Compose down

Docker Swarm & how it works

This is a docker service. It is use to manage Docker node cluster. But the each node will be containing the containers.

Docker Cluster: When master node is connected with minimum one worker node. Then we can say a docker cluster is created. We can connect any number of worker node to master node in docker cluster.

Docker Swarm is a container orchestration tool to manage the container on cluster or nodes.

So each node of the cluster can interact with each other with the help of API (application programming interface).

The container will be launch in the docker cluster with the help of a service. But the service will be containing the same image as multiple containers.


There are different process and command for installing on different operating system. When you have machine like: Linux, Windows, MacOS, etc.


This is very simple and easy for everyone to install it on linux. But for that you have to click on below button.


This is very simple and easy for everyone to install it on Windows. But for that you have to click on below button.


This is very simple and easy for everyone to install it on MacOS. But for that you have to click on below button.


In conclusion you have completed in this article almost everything,

What is Docker for.

How to use it.

Its life cycle.

How to Create Custom images.

Moreover manage multiple container with single command.

And then container orchestration tool.

Finally, I hope this article was very helpful for you to understand what is docker for. And now you have reached to a level, where you can talk about this to anyone.

So thank you for reading this article. Because your time matter for me.