The following instructions have been taken from: Install Docker Engine on Ubununtu
-
Update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update sudo apt-get install \ git \ ca-certificates \ curl \ gnupg \ lsb-release
-
Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo \ gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
-
Use the following command to set up the stable repository.
echo \ "deb [arch=$(dpkg --print-architecture) \ signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \ https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-
Update the apt package index, and install the latest version of Docker Engine, containerd, and Docker Compose:
$ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io \ docker-compose-plugin
-
Allow the current user to run docker without sudo:
sudo usermod $LOGNAME --append --groups docker
-
Verify that Docker Engine is installed correctly by running the hello-world image.
docker run --rm hello-world
-
Cleanup
docker image rm -f hello-world