详见官方文档https://docs.docker.com/install/linux/docker-ce/centos/
操作系统CentOS 7
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce
$ yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable
yum install docker-ce-<VERSION STRING>
#for example
yum install docker-ce-18.03.0.ce
systemctl start docker
docker run hello-world