How to Install Docker on Ubuntu 20.04 (Dockerhub Official)

How To Install Docker On Ubuntu 20.04

Daftar isi:

What is Docker

Here we want to show how to install Docker Community Edition. Docker is a container environtment to make developing process separated from the core system in a machine server. Every software with Docker running as if it is a single server without any conflict one another. The main system also safe from damage because the software updating program like APT will not be affected.

In addition, when the owner decided to move to another cloud server provider, the process not only easier but also simple. It is like backing a whatsapp message on a phone and restore it up on another phone.

Install Docker on Ubuntu

To install Docker on Ubuntu 20.04, it is good to prepare the Ubuntu for secure installation, that is, by setting another user other than root user. To do that, we could first, doing these steps:

  • Log in as user root
  • Add user by executing command adduser [name-of-user]. For example, we want to add user mimi. The command is: adduser mimi. You will be prompted by questions. Answer the questions or skip it by pressing Enter. Don’t forget to fill the password of the user
  • Give sudo access right to the recently added user by executing the following command: usermod -aG sudo mimi
  • Alter to recently added user by typing su command: su mimi

That all of initial Ubuntu server configuration.

Now we begin with Docker installation. First, we need to update Ubuntu.

sudo apt update

This command will update OS repository to the latest.

Then, we need to install CURL to enable installation over HTTPS protocol

sudo apt install apt-transport-https ca-certificates curl software-properties-common

We will install Docker from its official repository to get the latest version of Docker

curl -fsSL | sudo apt-key add -

Here we will add Docker repository to APT

sudo add-apt-repository "deb [arch=amd64] focal stable"

Now, to install from Docker repository instead of Ubuntu repository, we execute the following command:

apt-cache policy docker-ce

That is all the process that we need before installing Docker on Ubuntu system espescially Ubuntu 20.04. The next step, it is same as installing from APT:

sudo apt install docker-ce

After installation finished, the next step is to make Docker executable without sudo.

sudo usermod -aG docker mimi

Now, after logging out and logging in again, we could try our new Docker installation:

docker info

Working with Docker Images

Docker store the image in Docker repository called Hub. It is like a hosting company where we store files/folders. There we could store our Docker image. We could also find available ready to use image, from operating system to web server.

docker search nginx

Just type what we are going to search there. When we find it, we can pull it to our server:

Docker pull nginx

To run the image, we type the following command:

docker run --name docker-nginx -p 80:80 nginx

Now, we could test our Docker installation that is running Nginx, by accessing IP address of the server:



Docker is technology that enable everybody to build, deploy and detach from any machine and moving it to another machine in simple way. Understanding how Docker works will make our work simple in everyday task like backup and restore. It is like having our DVD. After recording, we need to insert it or eject it with one single touch.

I used to be a pilot, but ended up being just a mediocre writer.