How to Install Docker on Ubuntu 20.04

In this article, we will learn how to install Docker on Ubuntu 20.04 Focal Fossa. Installing Docker on Ubuntu 20.04 is not that hard. With few command lines that you can copy and paste, you will be able to run Docker in Ubuntu 20.04 within minutes.

Steps to Install Docker on Ubuntu 20.04

Update Ubuntu

First thing first, we need to update our system. Do a system update and then followed by system upgrade.

sudo apt update && sudo apt upgrade

Install additional packages

Next, we need to install some packages which allow apt to use the https connection.

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

Install GPG Key

Next, add the GPG key

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

Add the Docker repository to Ubuntu 20.04

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

Install Docker

Before we do the actual installation, let’s make sure that we are going to install from the Docker repository, not from Ubuntu repository. To do this, execute this command

apt-cache policy docker-ce

You should see something like this one below

dhani@dhani-ubuntu2:~$ apt-cache policy docker-ce
docker-ce:
Installed: (none)
Candidate: 5:19.03.12~3-0~ubuntu-focal
Version table:
*** 5:19.03.12~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
100 /var/lib/dpkg/status
5:19.03.11~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
5:19.03.10~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
5:19.03.9~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages

Now, we are good to go

sudo apt install docker-ce

Start Docker

Once the installation completes, lets run Docker and check the service status.

sudo systemctl start docker
sudo systemctl enable docker
sudo systemctl status docker

Output

Run Docker without sudo

By default, you will need sudo to run or execute Docker’s commands. You will need to run the following commands in order to run Docker without sudo. The currently logged in user will be able to run Docker commands without sudo by executing these commands

sudo usermod -aG docker ${USER}
su - ${USER}

Done. Now Docker is installed and you can start creating some containers. For more information, please visit: https://www.docker.com/

1 Trackback / Pingback

  1. How to Install MS SQL Server 2019 on Ubuntu 20.04 Using Docker | Manjaro dot site

Leave a Reply

Your email address will not be published.


*