卸载旧版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
yum安装gcc相关
yum -y install gcc
yum -y install gcc-c++
安装需要的软件包
yum install -y yum-utils
设置stable镜像仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
更新yum软件包索引
yum makecache fast
安装Docker CE
yum install docker-ce docker-ce-cli containerd.io
启动docker
systemctl start docker
测试
查看版本
docker version
docker run hello-world
卸载
停止
systemctl stop docker
卸载
yum remove docker-ce docker-ce-cli containerd.io
rm -rf /var/lib/docker
rm -rf /var/lib/containerd
阿里云镜像加速器
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://bd4dyl3u.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker