删除已安装的Docker
# Uninstall installed docker
sudo yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-selinux
docker-engine-selinux
docker-engine
配置阿里云Docker Yum源
# Set up repository
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Use Aliyun Docker
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装 Docker CE
更新 yum 软件源缓存,并安装 docker-ce。
sudo yum makecache fast
sudo yum install docker-ce
启动Docker服务
# Start docker service
systemctl enable docker
systemctl start docker