Post

Docker - Install and Configure

Installation

The Docker installation package available in the official Ubuntu repository may not be the latest version. To ensure we get the latest version, we’ll install Docker from the official Docker repository. To do that, we’ll add a new package source, add the GPG key from Docker to ensure the downloads are valid, and then install the package.

First, install docker prerequisites:

1
2
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg

Then add the official Docker repository to APT sources and install docker:

1
2
3
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt install docker-ce

Configuration

If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:

1
sudo usermod -aG docker <user.name>
This post is licensed under CC BY 4.0 by the author.