Linux

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 docker.io

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 https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

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

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu 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

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
or
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.

Akash

Recent Posts

Linux Software must have to improve Productivity

You can utilize a wide range of tools as a Linux user to keep organized, manage your time, and become… Read More

2 years ago

How to get Complete details of an Audio Video File

Have you ever caught yourself in a situation where you need details of an audio/ video media file? When you… Read More

4 years ago

Fix Windows 10 showing wrong time in dual boot with Linux

If you have installed Linux alongside windows in the dual boot you might have noticed that every time you boot… Read More

4 years ago

How to update Linux Kernel to the latest version easily

Linux kernel is like the core of the operating system. It's a piece of software that works as a middle… Read More

4 years ago

3 Methods for How to Install Python on Linux System

Nowadays, most Linux Distros already have Python preinstalled. But you might have a distribution that might not have Python preinstalled.… Read More

4 years ago

How to Install Python on Windows 10 to begin coding

Python is one of the most popular and easy to learn programming languages. Its a widely used high-level programming language… Read More

4 years ago

Just so that you know we use cookies on our website. Want to know more

read here