This shows the installation of Docker CE on Ubuntu. Following are the commands used:
#Uninstall existing installations
sudo apt-get remove docker docker-engine docker.io
#setup repo and Add Docker’s official GPG key
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
#INSTALL
sudo apt-get install docker-ce
#Test the docker installation
sudo docker run hello-world
#Setup docker to be used as a non-root user, to run docker commands without sudo.
#Exit and restart your SSH session so that your username is in effect in the docker group.
sudo usermod -aG docker `whoami`
#After exiting and restarting your SSH session, you should be able to run docker commands without sudo.
docker run hello-world