Last Updated on December 6, 2021 by sandeeppote

OS requirements

To install Docker Engine, you need the 64-bit version of one of these Ubuntu versions:

  • Ubuntu Hirsute 21.04
  • Ubuntu Groovy 20.10
  • Ubuntu Focal 20.04 (LTS)
  • Ubuntu Bionic 18.04 (LTS)

To check the OS version of Linux, use-

cat /etc/*release*

Check if you have already install docker on machine-

docker --version

Uninstall the older version of Docker if you have any, to do so-

sudo apt-get remove docker docker-engine docker.io containerd runc

Install Repository

Before the docker is installed setup the docker repository-

User Application Package Tool (APT) to install supporting packages for Docker. Use following commands-

sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Add Docker’s official GPG key:

GPG or GNU Privacy Guard is a public key cryptographic implementation and is used for allowing secure transmission of information between source and destination

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Install Docker Engine

sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io

This installs the latest version of docker on OS.

Check the latest version of docker

docker --version

Reference documents- https://docs.docker.com/engine/install/ubuntu/