Self-host Docker on Ubuntu 20.04

Lakmali Bandara
Oct 5 · 3 min read

keep this as a quick guide on how to install a docker on Ubuntu 20.04

The simple idea of the docker is a set of platform-as-a-service products used to launch and manage containers. Developers use Docker containers for developing and deploying applications because they provide isolated, lightweight, virtual environments.


All the commands are executed as sudo user, so bear in mind that you might have to prepend sudo to all the below commands.

I run all these steps as the root user. If you are not root, either prepend sudo to the commands or use the simulate initial login option of sudo to start an interactive shell as root: sudo -i

Step 1: Updating the Software Repository

Docker Registry is an application that manages to store and delivering Docker container images. Registries centralize container images and reduce build times for developers.

Docker images guarantee the same runtime environment through virtualization, but building an image can involve a significant time investment.

For example, rather than installing dependencies and packages separately to use Docker, developers can download a compressed image from a registry that contains all of the necessary components.

Start by opening a terminal window and updating the local repository:

sudo apt update

Wait for the process to complete.

Updating the Software Repository

Step 2: Downloading Dependencies

Allow your Ubuntu 20.04 system to access the Docker repositories over HTTPS by running:

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

The above-mentioned command:

Downloading Dependencies

Step 3: Adding Docker’s GPG Key

Next, add the GPG key to ensure the authenticity of the software package:

curl -fsSL | sudo apt-key add -
Adding Docker’s GPG Key

Step 4: Installing the Docker Repository

Now install the Docker repository using the command:

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

The command installs the latest repository for your specific Ubuntu release

Installing the Docker Repository

Step 5: Installing the Latest Docker

Start by updating the repository again:

sudo apt update

Now you can install the latest Docker version with:

sudo apt-get install docker-ce
Installing the Latest Docker

Step 6: Verifying Docker Installation

To confirm the installation check the version of Docker:

docker --version
Verifying Docker Installation

Step 7: Enable Docker Service

To start the Docker service run the following commands:

sudo systemctl start docker

Enable Docker to run at startup with

sudo systemctl enable docker

To check the status of the service, use the command:

sudo systemctl status docker

The output should show Docker is active (running).

This article should have helped you install and get started with Docker on Ubuntu 20.04. Keep readings :)


Medium’s largest Java publication, followed by 13200+ programmers. Follow to join our community.