From https://docs.docker.com/engine/install/
For Centos7
# yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
# yum install -y yum-utils
# yum-config-manager –add-repo https://download.docker.com/linux/centos/docker-ce.repo
# yum -y install docker-ce docker-ce-cli containerd.io
# systemctl start docker
# systemctl enable docker
For ElementaryOS Hera
# apt-get remove docker docker-engine docker.io containerd runc
# apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
# add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable”
# apt update
# apt-get install docker-ce docker-ce-cli containerd.io
For ElementaryOS loki
# apt-get remove docker docker-engine docker.io containerd runc
# apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
# add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable”
# apt update
# apt-get install docker-ce docker-ce-cli containerd.io