How to Install Docker on Ubuntu 20.04

Docker is a software platform that allows you to deploy applications in the form of containers. These containers are distributed as images without having to worry about all the dependencies this program needs such as libraries, system tools, code, and runtime. So if you are starting in the server world or you are an enthusiast, with this post, you will learn how to install Docker in an Ubuntu 20.04 operating system

So with Docker, the problem between developers and sysadmin disappears almost completely. Because the developers can create an image of their program and the system administrator can deploy it without affecting the rest of the system. Because Docker, similar to a virtual machine, creates an execution layer above the hardware and the operating system.

One of the main advantages of Docker is that it ensures that changes in library versions do not affect the program. If you create a web application that requires PHP 7.2 but the server operating system has PHP 7.1 then there will be a problem; however, if the application is distributed as a Docker image, the operating system will be able to run it and its execution will be independent of the PHP version of the system.

This is why Docker has a place of honor among developers and sysadmin.

Install Docker on Ubuntu 20.04

Docker can be installed on many different operating systems. And there are Linux distributions that package it into their repositories.

On the other hand, Docker developers have a repository for Ubuntu 20.04 that will help us keep the program updated. This will be the method we will use for this post.

So, install some packages needed to add the Docker repository.

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

Secure the repository by adding the repository GPG key. This process ensures that Ubuntu can consider it once it is added.

curl -fsSL | sudo apt-key add -



Now if you can add the Docker repository. To do so, just run this command:

sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

Now with the repository added to the system’s software sources, all that remains is to refresh APT.

sudo apt update

And install Docker and some related packages:

sudo apt install docker-ce docker-ce-cli docker-compose
Installing docker on Ubuntu 20.04
Installing docker on Ubuntu 20.04

Docker can be started, stopped, and restarted using the systemctl command because it is a system service. This will also help a lot to know the status of the application, for example:

sudo systemctl status docker
Docker Status
Docker Status

So, Docker is properly installed.

Testing Docker on Ubuntu 20.04

According to Docker’s official documentation, the best way to know if it’s working is to run an image.

However, there is a special image that was created with this intention is called hello world

So we have to download it and run it. To do this, run:

sudo docker run hello-world


Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:49a1c8800c94df04e9658809b006fd8a686cab8028d33cfba2cc049724254202
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:

For more examples and ideas, visit:
Running the Docker test image
Running the Docker test image

In the same screen output, it indicates that the Docker installation has been successful. Therefore, it is possible to start working with it.


Learning about Docker can not only help you grow as a professional but also open up economic opportunities. But you have to start by learning how to install it in a system as popular as Ubuntu 20.04 and thanks to this post you have managed to do so.

More info: Docker Website, Docker Official Documentation

Scroll to Top