1、查看centos版本信息
cat /etc/redhat-release
2、centos7更换为阿里云源:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
3、yum安装gcc相关软件
yum -y install gcc
yum -y install gcc-c++
4、卸载docker旧版本
yum -y remove docker docker-common docker-selinux docker-engine
5、安装所需软件
yum install -y yum-utils device-mapper-persistent-data lvm2
6、设置stable镜像仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
7、更新yum软件包索引
yum makecache fast
8、安装DOCKER CE
yum -y install docker-ce
9、启动docker
systemctl start docker
10、测试
- 查看docker版本:docker version
- 拉取hello-world镜像并测试
docker pull hello-world docker run hello-world
11、配置镜像加速
https://cr.console.aliyun.com/undefined/instances/mirrors
12、卸载
systemctl stop docker
yum -y remove docker-ce
rm -rf /var/lib/dockersystemctl stop docker
yum -y remove docker-ce
rm -rf /var/lib/docker