ubuntu卸载docker流程

发布时间:2023年12月26日

之前不小心误操作删除重装docker,结果删除没成功,更没法重装,每次apt install都会报一个docker错误,

? Process: 32174 ExecStart=/usr/bin/dockerd --graph=/home/hxb/docker/lib/docker (code=exited, status=1/FAILURE)
?

虽然不影响软件的常规安装~但是现在还是需要装一个完整docker,还是选择删除一下,重点是关闭服务,关闭服务就好卸载了。

卸载步骤如下:

  1. 停止Docker服务:
sudo systemctl stop docker

  1. 卸载Docker软件包:
sudo apt-get purge docker-ce docker-ce-cli containerd.io

  1. 删除Docker相关的配置文件和目录:
sudo rm -rf /var/lib/docker
sudo rm -rf /etc/docker

  1. 删除Docker用户组:
sudo groupdel docker

  1. 删除Docker存储库的APT源:
sudo rm /etc/apt/sources.list.d/docker.list

下面是安装docker

  1. 更新apt软件包索引:
sudo apt update

  1. 安装必要的软件包,以允许apt通过HTTPS使用存储库:
sudo apt install apt-transport-https ca-certificates curl software-properties-common

  1. 添加Docker的官方GPG密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

  1. 添加Docker存储库:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

  1. 更新apt软件包索引:
sudo apt update

  1. 安装Docker引擎:
sudo apt install docker-ce docker-ce-cli containerd.io

  1. 启动Docker服务:
sudo systemctl start docker

  1. 验证Docker是否正确安装:
sudo docker run hello-world

?

?仍旧遇到老问题

$ sudo systemctl start docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.



$ systemctl status docker.service
● docker.service - Docker Application Container Engine
? ?Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
? Drop-In: /etc/systemd/system/docker.service.d
? ? ? ? ? ?└─devicemapper.conf
? ?Active: failed (Result: exit-code) since Tue 2023-12-26 11:32:09 CST; 6s ago
? ? ?Docs: https://docs.docker.com
? Process: 34510 ExecStart=/usr/bin/dockerd --graph=/home/hxb/docker/lib/docker (code=exited, status=1/FAILUR
?Main PID: 34510 (code=exited, status=1/FAILURE)


?

文章来源:https://blog.csdn.net/huqinweI987/article/details/135217711
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。