How To Install Docker on Ubuntu 20.04?

by | 26.07.2021 | Tutorial

Docker is an open-source tool that makes managing application processes in containers much easier. Containers allow you to run your programmes in separate processes with their own resources. Containers are comparable to virtual machines, except they’re more portable, resource-friendly, and more reliant on the host OS.

Learn more about them here:

In this post, we would walk through how to install the stable version of Docker on Ubuntu 20.04. I am using an Azure VM for the demonstration, but you can use any system with Ubuntu 20.04! Installing in a VM, Cloud Instance, all are the same process 🙂

Let’s Start!


To follow this tutorial, you will need the following:

  • One Ubuntu 20.04 server set up including a sudo non-root user.

Thing Not to Do

Don’t use apt package manager to install Docker. It’s generally outdated and won’t serve your purpose. We’ll download Docker from the official Docker repository to guarantee we obtain the most recent version. To do so, we’ll add a new package source, add the Docker GPG key to verify the downloads, and then install the package.

Also, remember that Docker Machine and Compose needs to be installed manually only on Linux. Docker Toolbox manages the installation on Windows and Mac.

Update your system

sudo apt update ##to update your packages
sudo apt upgrade ##to install the newer versions of the updated packages

Now, we have an updated system. We can go ahead to install docker!

Install Docker Engine

There are many ways to install docker, but the easiest way is to install it using a shell script!

Step 1: Go to, and you would find the following script. Use that to install docker without any hassle and in under few minutes.

# This script is meant for quick & easy install via:
curl -fsSL -o

Step 2: Wait for few minutes.

Install docker

Step 3: Test the Installation with sudo docker version

install docker on ubuntu 20.04

Docker Machine

The machine allows you to set up Docker hosts on your computer, in the cloud, and in your own data centre. It sets up servers, installs Docker on them, and sets up the Docker client to communicate.

Step 1: You can find the latest release here on GitHub! Install using the commands on Linux!

install docker on ubuntu 20.04
curl -L <`uname> -s`-`uname -m` >/tmp/docker-machine &&
    chmod +x /tmp/docker-machine &&
    sudo cp /tmp/docker-machine /usr/local/bin/docker-machine

Step 2: Test the Installation with sudo docker-machine version

install docker on ubuntu

Docker Compose

At last, you need to install Docker Compose. Compose is a tool that allows you to define and operate multi-container Docker applications. You configure your application’s services using Compose with a YAML file.  Compose work in all environments, including production, staging, development, testing, and continuous integration workflows.

So, let’s install the latest version! The GitHub page states that 1.29.2 is the latest version so, we use 1.29.2 on the command!

Step 1: To get the latest stable version of Docker Compose, use this command:

sudo curl -L "<$>(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Step 2: Apply executable permissions to the binary:

sudo chmod +x /usr/local/bin/docker-compose

Step 3: Test the Installation with sudo docker-compose version

install docker

Executing the Docker Command Without Sudo (Optional)

Step 1: While performing docker tasks, you would not perform tasks without sudo access. The permission is required because the Docker daemon needs root access to run.

install docker on ubuntu 20.04

Step 2: Using sudo usermod -aG docker $USER where $user in this scenario, is hrittik would help.

Step 3: Logout and Login again to see the changes. We can see after the login that the Debian image is pulled without the Sudo command.

install docker on ubuntu 20.04

Final Thoughts

We went from a fresh VM to installing a fully functional Docker on an Azure VM in this tutorial. As mentioned above, you can use this on any machine running Ubuntu 20.04!

Feel free to subscribe to our newsletter, and don’t forget to check our blog section for high-level overview posts like the following:

Happy Containerizing!


The DevOps Awareness Program

Subscribe to the newsletter

Join 100+ cloud native ethusiasts


Join the community Slack

Discuss all things Kubernetes, DevOps and Cloud Native

Related articles6

How to Delete all Pods in ReplicaSet

How to Delete all Pods in ReplicaSet

When administering your Kubernetes cluster, you will likely run into a situation where you need to delete pods from one of your ReplicaSet. You may need to debug issues with the ReplicaSet itself, or other reasons.

Delete namespace stuck in Terminating State

Delete namespace stuck in Terminating State

Deleting a namespace is just a line of command, but when it is stuck in a Terminating state it starts to give you a headache. In this small tutorial, we would go on to how to delete a namespace that’s stuck.  What’s is a stuck Namespace? Whenever you find your...

How to Install Portainer on Remote Server ft. VSCode?

How to Install Portainer on Remote Server ft. VSCode?

Portainer is one of the most popular and trusted GUI for managing Docker, Swarms, ACIs and Kubernetes. The company boasts on its’ website for having 500K users, and there’s no doubt to the number looking at how easy it makes managing the tools. This post goes on the...