菜鸟教程-常见命令:https://www.runoob.com/docker/docker-command-manual.html
1. 准备工作:
1.1 杀死docker有关的容器:
bash
docker kill $(docker ps -a -q)
1.2 删除所有docker容器:
bash
docker rm $(docker ps -a -q)
1.3 删除所有docker镜像:
bash
docker rmi $(docker images -q)
1.4 停止 docker 服务:
bash
systemctl stop docker
1.5 删除docker相关存储目录:(分别进行执行以下四个命令)
bash
rm -rf /etc/docker
rm -rf /run/docker
rm -rf /var/lib/dockershim
rm -rf /var/lib/docker
如果删除不掉,则先umount:
bash
umount /var/lib/docker/devicemapper
然后再重新执行上面那步"删除docker相关存储目录"。
2. 卸载工作
2.1 查看系统已经安装了哪些docker包:
bash
yum list installed | grep docker
卸载相关包:
bash
yum remove containerd.io.x86_64 docker-ce.x86_64 docker-ce-cli.x86_64 docker-ce-rootless-extras.x86_64 docker-scan-plugin.x86_64
检查是否删除成功
bash
yum list installed | grep docker
# 不显示结果
docker version
# 提示:-bash: /usr/bin/docker: No such file or directory