以下内容取自官方网站:
#卸载旧版本docker $ sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
#安装依赖包 $ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
#添加docker源 $ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
#安装docker $ sudo yum install -y docker-ce docker-ce-cli containerd.io
#启动docker服务 $ sudo systemctl start docker
#设置docker自动启动 $ sudo systemctl enable docker