本例以centos 7.4为例
1、卸载cetnos 7自带的docker 软件
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
2、安装docker引擎
1)安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
2)设置yum源和存储库
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3)安装DOCKER CE
yum install docker-ce docker-ce-cli containerd.io
3、启动docker
systemctl start docker
4、运行docker,验证docker服务
docker run hello-world
5、卸载
yum remove docker-ce
rm -rf /var/lib/docker
6、Docker 仓库源更新
vim /etc/docker/daemon.json
{
"registry-mirrors":["https://registry.docker-cn.com"]
}
systemctl restart docker