To install Docker on an Ubuntu VM, you can follow these steps:
1/ Update apt package index:
sudo apt update
2/ Install dependencies to allow apt to use a repository over HTTPS:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
3/ Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4/ Set up the Docker repository: For Ubuntu 20.04:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
5/ Update the apt package index again:
sudo apt update
6/ Install the latest version of Docker CE (Community Edition):
sudo apt install docker-ce
7/ Verify Docker installation by running a simple container:
sudo docker run hello-world