参考地址:https://blog.csdn.net/weixin_43526371/article/details/125811270
下载 Docker Engine
https://docs.docker.com/engine/install/centos/
查看系统版本
$ cat /etc/redhat-release
# CentOS Linux release 7.9.2009 (Core)
卸载旧docker方式
$ sudo yum remove docker
$ sudo yum remove docker-client
$ sudo yum remove docker-client-latest
$ sudo yum remove docker-common
$ sudo yum remove docker-latest
$ sudo yum remove docker-latest-logrotate
$ sudo yum remove docker-logrotate
$ sudo yum remove docker-engine
安装docker
# C语言编译器
$ yum -y install gcc
$ yum -y install gcc-c++
# 大多数用户选择安装docker的配置方式
$ yum install -y yum-utils
# 配置仓库
$ yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 推荐 更新yum软件包索引
$ yum makecache fast
# 安装dockerEngine
$ yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
# 运行docker
$ systemctl enable docker
$ systemctl status docker
$ systemctl start docker
# 查看系统版本
$ docker version
# 运行测试是否成功
$ docker run hello-world
# 卸载
$ yum remove docker-ce docker-ce-cli containerd.io docker-compose-plugin
$ sudo rm -rf /var/lib/docker
$ sudo rm -rf /var/lib/containerd
标签:sudo,remove,yum,ce,Linux,Docker,安装,docker From: https://www.cnblogs.com/js1314/p/17032254.html