How to install Docker on Ubuntu 20.04

Docker is an increasingly popular software package that simplifies the process of managing application development processes in containers. This lets you run your applications in resources isolated processes.

You can also consider it somewhat similar to virtual machines, but the difference is these containers are more dependent on the host operating system. As containers share kernel and other resources with the host operating system. Containers are also more portable, more resource-friendly then virtual machines.

There are two versions of Docker, one is Docker CE (community edition) and the other is Docker DE (Enterprise Edition). In this tutorial we will install Docker CE (community edition) on Ubuntu 20.04.

So lets get started and just follow the steps.

Installing Docker on Ubuntu 20.04

The docker is available in official Ubuntu repositories, but it doesn’t need to always be the latest version. So first I will show how you can Install Docker through Ubuntu repositories and then I will also show how you can download Docker directly through Docker repositories. You can follow whichever method which you like.

Method 1: Installing Docker through Ubuntu repositories

Step 1: Its a nice practice to update existing package information before installing any new package.

Open a terminal and execute the command below:

sudo apt update

Then wait till this execution gets completed.

Step 2: Now lets Install Docker on Ubuntu

sudo apt install

Step 3: Start Docker and enable starting Docker at startup

After installing Docker we need to start Docker service. To do so just execute the commands below.

sudo systemctl start docker
sudo systemctl enable docker

This completes installing Docker and enabling it. Now you can see the other method of installing with Docker repositories.

Method 2: Installing Docker from Docker repositories

Step 1: Update list of existing packages.

As I said earlier it’s nice to update existing package information before installing any new packages, so let’s start with updating packages first.

sudo apt update

Step 2: Now lets install few prerequisite packages which let apt use packages to access Docker repositories over HTTPS.

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

Step 3: Add Docker’s GPG Key

Then lets add GPG key for the official Docker repository on the system.

curl -fsSL | sudo apt-key add -
install docker on Ubuntu 20.04

Step 4: Now lets add the Docker repository to APT sources:

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

Now here we are installing on Ubuntu version 20.04 that’s why in the above command focal is used. If you are on any other Ubuntu version you can replace the above command with the codename of that version.

If you want you can also replace focal with $(lsb_release -cs) this command scans and returns codename of your Ubuntu installation.

Step 5: Now lets again update package database as we have added Docker repo now.

sudo apt update

Step 5: Install Docker from Docker repository

sudo apt install docker-ce

This should install Docker and will auto enable it also. Just check if its running and then you can stop checking by pressing Ctrl and C keys together:

sudo systemctl status docker
check installation of docker on Ubuntu 20.04

This completes installation of Docker on your Ubuntu 20.04 system.

Uninstall Docker from your system

If you are done using docker you can remove docker using the command below.

sudo apt remove docker
sudo apt remove docker-ce         (if installed using second method)

If you have added Docker through Docker repository then just follow the steps below to remove the repository.

Press (Super or Windows key) and then search for Software Sources.

In the Software Sources, navigate to the Other Software tab. Then select the docker repository in it and click on Remove.

So here we have seen how we can easily install Docker on Ubuntu 20.04. Do you know you can install more than 6500 Windows games on Linux now.

Leave a Reply

Share via
Copy link
Powered by Social Snap