What is Docker and How to install it on Ubuntu 20.04 Server?

Posted on September 12th, 2022

There has always been this debate between virtualization and containerization. But clearly with the help of Docker, which uses containers for deploying mobile and web-based applications, the process of software development has become effortless.  

Now that more and more companies are using docker containers, it is crystal clear that using docker for deploying the application is secure as well.

By reading the above statements, if you are new to using Docker you must be wondering what exactly it is. To answer your question I have written in-depth about what Docker is and how you can use Docker containers to deploy your applications.

Docker is a tool that helps us to launch multiple containers which are made from the operating system’s images and can be launched within seconds.  

To launch a traditional operating system from any of the cloud services like AWS, Google Cloud, or digital ocean takes some time. But creating the same OS on top of these servers with the help of docker can be done within seconds.

Docker provides containers that have a consistent environment and are application-friendly for deploying various applications.

Docker is open source and it is one of the best containerization platforms in the market currently. It helps not only the developers but also DevOps engineers to package their software code into standardized and executable containers.  

Creating a Docker container is very easy and because of this reason, IT professionals are switching from virtualization-based to docker-based deployments.

Not only this, DevOps engineers can now integrate Docker with Jenkins and hence can perform continuous integration and continuous delivery very smoothly.

Why do Most companies prefer using Docker For Deployments?

Docker was launched in 2013, and since then it has been the market leader.

Currently, Docker has captured 24.99 percent of the containerization market numerous multinational companies are using Docker because it created a deployment environment within a few minutes. If that environment/container stops working then, replicas of the same container can be created by executing very few commands.

Not only this, Frontend and backend applications that are deployed on doctor will function smoothly, and even if there is some problem, then we can launch the same application within seconds.

Containers are lighter in weight and because of this they show great efficiency and improve the productivity of developers and DevOps engineers.  

How to Install Docker On Ubuntu 20.04 LTS?

Now that we understand what docker is and its importance for the software deployment process, let’s understand how to install it on Ubuntu 20.04 LTS operating system.

The process of docker installation for every operating system can be different but for this specific version of Ubuntu i.e 20.04 LTS we will follow the commands that are mentioned below.

Although before installing docker on your Ubuntu operating system it is highly recommended that you have wget installed and your Ubuntu OS and also your operating system is up to date. 

If you don’t have the above two prerequisites then execute the below two commands

$ sudo apt-get update
$ sudo apt-get wget 

Now, you can use the below commands for installing docker.

Commands for Installing Docker On Ubuntu 20.04 LTS

The commands that are mentioned below are in sequence and must be executed in the below-mentioned chronological order. 

Even if one command is missed then Docker will probably not function as it is supposed to be.

$ sudo apt update
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
$ apt-cache policy docker-ce
$ sudo apt install docker-ce
$ sudo systemctl status docker

From the above commands, you may be frequently using the status docker command. As the name suggests, the $ systemctl status docker command will show you whether the docker application is in the active state or in the inactive state.  

You will get similar output after Docker is successfully installed with the above mentioned commands.

If docker is active and you have containers running then there would be no problem but the containers won’t function properly if the state of doctor is inactive. 

Now we have successfully installed docker on Ubuntu operating system.  

How To Execute Docker Without The sudo (root) Privileges –

You must have noticed that every time we use the above command we add a prefix of sudo (administrator power).

This indicates that each time before executing the docker command we have to take permission from the root user.

If you want to have your docker user full permission and don’t want to add prefix sudo each time the command executes then use the commands mentioned below.

$ sudo usermod -aG docker ${USER}
$ su - ${USER}
$ sudo usermod -aG docker username

Deploying NGINX On Docker Container

Now that we have installed docker, let’s create a container from the NGINX image and test if docker is able to run that application or not.

To pull a NGINX image from Docker Hub we use the following command.

$ docker run -it -d --name nginx -p 80:80  nginx

We have pulled a NGINX image from docker hub and created its  container.

The NGINX image and the container  running can be seen using these commands.

$ sudo docker images
$ sudo docker ps -a

We have created a container who’s ports we have directed to 80. Now if we want to access this NGINX image we use the public IP of our Ubuntu OS followed by the port number.

In my case it is

As you can see above, we have successfully installed docker and created a NGINX docker container out of a Docker image.


We have learned about what is docker and why using docker is preferable to any other tool right now. Other than this we have also configured and set up docker with easy steps.

If you have any doubts regarding the installation process of docker then you can comment below. We will surely reply with the respective solution.

Leave a Reply