How to Get Install Docker On Ubuntu 20.04 LTS

Docker is an Open source technology that allow you to install an run application on several container (machine) without Interfering with the host or other containers.

Container technology is similar to Virtualization, but it is more portable and easy to use.

What are the type of Docker are available?

There is two types of Docker are available Docker CE (Community Edition) and Docker EE (Enterprise Edition).

Which type of version should choose?

If you are a beginner who just wants to learn how to use docker or you have some minor projects go for Docker CE.
For large-scale go for the Docker EE in that, you will get the support from Certified Team.

Docker CE (Community Edition) come up with two editions Stable and Edge. The difference is that the Stable version gets an update every quarter and Edge gets an update every month with latest and security updates.

So, In this article, we learn how to install Docker on Ubuntu 20.04 LTS machine.

Prerequisites

To continue with this guided article, you should have Install Ubuntu 20.04 LTS 64-bit version, and you have the sudo privilege.

Install Docker from Ubuntu Repositories

Install Docker from Official Repositories

Install Docker from .deb Packages

Method 1: Install Docker Using Ubuntu Repositories

Before starting the installation, I’ll like to highlight you can Install docker from the Ubuntu repository, but the small problem is you will not get the latest version.

So what I have decided I’ll guide you how you can install Docker from Ubuntu Official repository as well as another method through you can Install the latest version.

If you are not concerned with the latest version, you can follow this method or else you can skip it.

Step 1: Update Ubuntu Software Repositories

Always update the official repositories before Installing any software. This will ensure that whatever application you are trying to install should be latest as per the repositories data despite the latest version being different from the official site.

To update repository open a terminal and type the following command:

$ sudo apt update -y
$ sudo apt upgrade -y

Wait for sometime to get process complete.

Step 2: Install Docker on Ubuntu 20.04

Once the update and upgrade process is complete we will install Docker. To install Docker pass the below command in terminal:

$ sudo apt install docker.io

Accept the confirmation and wait for some moment to complete the above process.

Step 3: Verify Docker

We have installed the Docker from the Ubuntu repository now we will check whether Docker is installed successfully.

Open terminal and type below command to check docker version:

$ docker --version

Docker version 19.03.8, build afacb8b7f0

This shows docker is installed successfully in Our Ubuntu 20.04 systems.

Step 4: Start and Enable Docker

When we install the docker by default it will be inactive, To check the current status type in terminal:

$ sudo systemctl status docker

● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor prese>
     Active: inactive (dead)
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com

So, we need to start docker service, and it’s should automatically get started when the system boots up

Type the following commands to make changes:

$ sudo systemctl start docker
$ sudo systemctl enable docker

Once we pass the above command, let’s verify the changes were made successfully:

$ sudo systemctl status docker

● docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: en>
     Active: active (running) since Thu 2021-01-28 10:08:19 IST; 1min 38s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 40857 (dockerd)
      Tasks: 12
     Memory: 36.6M
     CGroup: /system.slice/docker.service
             └─40857 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/contain>

That’s all to install Docker from Ubuntu Official repository. If you have already installed docker before reading this article and now you want to install the latest Docker version from Official site before that, you need to remove older Docker version.

Uninstall old versions

If you already have an older version of Docker and you want to install the latest from the below method prior to that remove the older version of Docker.

To remove docker from Ubuntu machine type command:

$ sudo systemctl stop docker.io
$ sudo apt remove docker.io

You have removed the older version of Docker, and now we will enable and install the latest version of Docker from an Official site repository.

Method 2: Install Docker from Official Repository

To install Docker from Official repository, we need to do some extra steps such as Install Dependencies, add GPG key, and install Docker with some tweaks.

Enabling Docker repository 

In a simple step, you will be able to enable Docker repository before that update the local packages.

Step 1: Update Ubuntu Software Repositories

Open your Ubuntu Terminal and type below commands:

$ sudo apt update
$ sudo apt upgrade

Step 2: Download Required Dependencies

To move ahead, we required to install few Dependencies for that open Ubuntu terminal and do the copy-paste below command:

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

Accept the consent to Install required packages.

Step 3: Import Docker GPG key

We need to import the GPG key using the curl command. If you are thinking, what is GPG key? A GPG (GNU Privacy Guard) key is a security mechanism which verifies the file is genuine.

To import pass the below command in your Ubuntu terminal:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Output

OK

Step 4: Add the Docker APT repository

This is the final step to add Docker to your Ubuntu repository pass the below command in your Ubuntu terminal and press the enter.

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Output

linux/ubuntu $(lsb_release -cs) stable"
Get:1 https://download.docker.com/linux/ubuntu focal InRelease [36.2 kB]
Get:2 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages [6,247 B]
Hit:3 http://in.archive.ubuntu.com/ubuntu focal InRelease                          
Hit:4 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease           
Hit:5 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease
Get:6 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [24.2 kB]
Get:8 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [56.5 kB]
Fetched 232 kB in 2s (116 kB/s)            
Reading package lists... Done

If you focus on the above command, we have used $(lsb_release -cs) this command will check and return the codename of your Ubuntu installation. And the last word of the command is stable this indicates we are installing a stable version of Docker.

Above we have mentioned, Docker community edition comes up with two types of release: stable and edge.

If you don’t want to use stable version you can replace with edge.

Install Docker

We are able to add and enable docker to our Ubuntu repositories now it’s time to install Docker.

Step 1: Update Ubuntu Repositories

This is the last time we will ask you to update repositories type:

$ sudo apt update

Step 2: Install Docker

Once the update is completed, pass the below command to install docker on your system, or If you want to install a specific version of Docker, you can skip the below command.

$ sudo apt install docker-ce
Output

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  bridge-utils ubuntu-fan wmdocker
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  containerd.io docker-ce-cli docker-ce-rootless-extras slirp4netns
Suggested packages:
  aufs-tools
The following packages will be REMOVED:
  containerd runc
The following NEW packages will be installed:
  containerd.io docker-ce docker-ce-cli docker-ce-rootless-extras slirp4netns
0 upgraded, 5 newly installed, 2 to remove and 0 not upgraded.
Need to get 103 MB of archives.
After this operation, 309 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

If you want to install a specific version of Docker first we have to list out the available version from the Docker repository:

$ apt list -a docker-ce
Output

Listing... Done
docker-ce/focal 5:20.10.1~3-0~ubuntu-focal amd64
docker-ce/focal 5:20.10.0~3-0~ubuntu-focal amd64
docker-ce/focal 5:19.03.14~3-0~ubuntu-focal amd64
docker-ce/focal 5:19.03.13~3-0~ubuntu-focal amd64
docker-ce/focal 5:19.03.12~3-0~ubuntu-focal amd64
docker-ce/focal 5:19.03.11~3-0~ubuntu-focal amd64
docker-ce/focal 5:19.03.10~3-0~ubuntu-focal amd64
docker-ce/focal 5:19.03.9~3-0~ubuntu-focal amd64

For example, I need to install 5:20.10.1~3-0~ubuntu-focal I’ll append the command like the below, and press enter key to start the installation process.

$ sudo apt install docker-ce=5:20.10.1~3-0~ubuntu-focal 

This is the optional step if you don’t want to auto-update Docker package, you can disable that too.

$ sudo apt-mark hold docker-ce

Output
docker-ce set on hold

Step 3: Check version

We have finished the installation process if you want to check Docker version pass the following command in terminal:

$ docker --version

Output
Docker version 20.10.2, build 2291f61

Method 3: Install Docker for .deb package

From the above method, we are able to install Docker still if you want to install the latest docker in a very simple you can follow this method.

Step 1: Download .deb file

To Download Docker-ce-cli_xx.xx.xx.deb file Click on the below button and follow the further instructions:

After the page gets load, select the latest or the required docker.package .deb file and wait for the file to be downloaded.

Download docker.deb

Once the download is complete open your terminal and go to the directory where the file is present and Install the file.

Read this Top 4 Simple way to install Deb file on Ubuntu

Command Syntax

$ sudo dpkg -i /Path/docker-xxxxx.deb

In my case, I have downloaded docker-xxxx.deb file to the Download folder and start the installation process.

$ sudo dpkg -i ~/Downloads/docker-ce-rootless-extras_20.10.0_3-0_ubuntu-focal_amd64.deb 

After that installation is completed, now you can run Docker from the terminal itself.

Wrap-Up

That’s all to Install Docker on Ubuntu 20.04 LTS(FOCAL). We have shared you the three methods to Install Docker. If you want to install Docker Please go with Method 2.

Please let me know in the comment section how this guided article helps you to install Docker.

This Post Has 10 Comments

  1. Casey

    Someone necessarily lend a hand to make severely posts I
    might state. This is the very first time I frequented your web page and to
    this point? I amazed with the analysis you made to create this actual put up incredible.
    Wonderful activity!

  2. compact hpl 12mm

    This is a topic which is near to my heart… Many thanks!
    Exactly where are your contact details though?

  3. Nichole

    Magnificent items from you, man. I have remember
    your stuff previous to and you’re just too great.
    I actually like what you’ve received here, certainly like what you’re stating
    and the way in which wherein you say it. You make it enjoyable and
    you continue to take care of to keep it smart.
    I cant wait to learn far more from you. That is actually a great web site.

  4. Leo

    Thank you for another excellent post. The place else could anybody get that kind of information in such a perfect way
    of writing? I have a presentation next week, and I’m at the look for such info.

  5. Roxie

    Heya i am for the primary time here. I came across this board
    and I to find It really helpful & it helped me out much.
    I hope to provide something again and aid others like you aided
    me.

  6. Leonel

    Its not my first time to go to see this web page, i am visiting this site dailly and get fastidious
    facts from here every day.

  7. Kelley

    I am in fact grateful to the holder of this web page who has shared this great
    paragraph at at this place.

  8. Brad

    Hi, I would like to subscribe for this weblog to take latest updates, thus where can i do it please help.

  9. Chu

    Good post. I learn something new and challenging on sites I stumbleupon on a daily basis.

    It’s always helpful to read through content from other authors and practice something from other sites.

Leave a Reply