-
卸载旧版本
sudo 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++
-
设置存储库
sudo yum install -y yum-utils
#镜像仓库换成阿里云
sudo yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
-
安装docker ce
yum -y install docker-ce docker-ce-cli containerd.io
-
启动docker
systemctl start docker
-
测试
docker version
docker run 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