yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
yum install -y yum-utils
默认是国外的,不推荐,下载很慢
yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
推荐使用阿里云的
yum-config-manager \ --add-repo \ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
更新yum软件包索引
yum makecache fast
yum install docker-ce docker-ce-cli containerd.io
systemctl start docker
查看是否启动成功
docker version
测试helloword镜像
docker run hello-world
查看镜像
docker images
先卸载依赖
yum remove docker-ce docker-ce-cli containerd.io
后卸载资源
rm -rf /var/lib/docker