1、移除旧版的Docker,防止出错
yum remove docker
yum remove docker-client
yum remove docker-client-latest
yum remove docker-common
yum remove docker-latest
yum remove docker-latest-logrotate
yum remove docker-logrotate
yum remove docker-selinux
yum remove docker-engine-selinux
yum remove docker-engine
2、安装必备的工具:
yum install -y yum-utils device-mapper-persistent-data lvm2
3、添加软件源信息
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4、更新 yum 缓存:
yum makecache fast
5、安装 Docker-ce:
yum -y install docker-ce
6、启动 Docker 后台服务
systemctl start docker
7、加入开机自启动
systemctl enable docker