Start by running Ubuntu updates
sudo apt update && sudo apt upgrade
First we have to install the required packages
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Add the Docker GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Now we have to install the Docker repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Now we are able to install Docker
sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io
Docker has been installed.
Check if Docker is working
sudo docker run hello-world
If you get the following message, your Docker installation is working:
Hello from Docker! This message shows that your installation appears to be working correctly.