1、安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
2、添加docker软件包源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum makecache fast
yum repolist all
yum repolist all | grep enabled
3、查看所有仓库中所有docker版本,并选择特定版本安装
yum list docker-ce --showduplicates | sort -r
4、安装Docker-ce
yum install docker-ce-20.10.9
# yum install docker-ce-18.03.1.ce
5、启动docker并设置开机自启
systemctl start docker
systemctl enable docker