卸载旧版本docker
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-ce
安装GCC环境
yum -y install gcc
yum -y install gcc-c++
安装yum工具
yum install -y yum-utils device-mapper-persistent-data lvm2 --skip-broken
设置docker仓库
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo
更新yum包软件索引
yum makecache fast
安装docker
yum -y install docker-ce docker-ce-cli containerd.io
启动docker
systemctl start docker
设置docker开机启动
systemctl enable docker
查看docker版本
docker version
配置镜像加速
执行hello-world
卸载docker
systemctl stop docker
yum remove docker-ce docker-ce-cli containerd.io
rm -rf /var/lib/docker
rm -rf /var/lib/containerd