CentOS 7:
Install the necessary utilities:
yum install -y yum-utils \ device-mapper-persistent-data lvm2
Add the Docker repository to install the current version:
yum-config-manager --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
Install Docker:
yum install -y docker-ce
Ubuntu:
Update the list of packages and install the necessary ones:
apt update
apt install -y \ apt-transport-https \ ca-certificates \ curl \ software-properties-common
Add the repository key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
Add the repository itself and re-read the list of packages:
add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
apt update
Install Docker:
apt install -y docker-ce
P.S. Docker Engine is deprecated, CE must be installed.