sudo apt-get update
sudo apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
Add the Docker GPG key and repo - with the GPG key (it’s a public key in an asymmetric encryption) the system can validate that the software to be downloaded from that repo is really coming from there.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Install Docker CE packages
sudo apt-get install docker-ce docker-ce-cli
Add non-root users to docker group
sudo usermod -a -G docker <your_user>
check docker installation and version
sudo docker version
run a container test
docker run hello-world