无法在 WSL 上从 Ubuntu 卸载 Docker [英] Cant uninstall Docker from Ubuntu on WSL

查看:95
本文介绍了无法在 WSL 上从 Ubuntu 卸载 Docker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试卸载 Docker,但总是出现错误.我已经在互联网上搜索过,但没有成功修复错误.我的印象是有一些损坏的软件包,但总的来说我对 Linux 很陌生.结果如下:

I am trying to uninstall Docker but I always get an Error. I already searched in the internet but wasnt succesful to fix the error. I have the impression there are some broken packages but I am very new to Linux in general. This is the result:

sudo apt-get purge -y docker-ce 
                                                                                                                                                 1 ↵ Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  docker-ce*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 181 MB disk space will be freed.
(Reading database ... 44147 files and directories currently installed.)
Removing docker-ce (18.03.1~ce-0~ubuntu) ...
invoke-rc.d: could not determine current runlevel
 * Stopping Docker: docker                                                                                                                                                                                      start-stop-daemon: warning: failed to kill 466: No such process
No process in pidfile '/var/run/docker-ssd.pid' found running; none killed.
invoke-rc.d: initscript docker, action "stop" failed.
dpkg: error processing package docker-ce (--purge):
 subprocess installed pre-removal script returned error exit status 1
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)

我希望有人能帮我解决这个问题.:)

I hope anybody can help me with that. :)

推荐答案

我在尝试从 WSL 中删除 docker.io(显然是预装的)时遇到了同样的错误.问题是预删除脚本失败,因为 docker 从未运行过,因此无法停止.

I had this same error trying to remove docker.io from WSL, which is apparently preinstalled. The problem is that the pre-removal script is failing because docker has never run, and therefore it cannot be stopped.

在我的情况下,我对/var/lib/dpkg/info/docker.io.prerm 进行了 sudo 编辑,并用 true 替换了 /sbin/stop docker(失败了)代码>(它只是返回成功).之后,apt remove docker.io 完美运行.

In my case I sudo-edited /var/lib/dpkg/info/docker.io.prerm and replaced /sbin/stop docker (which was failing) with true (which simply returns success). After that, apt remove docker.io worked perfectly.

(我在这里找到了解决方案,一个 2013 年的老问题:docker 无法卸载,如果它从来没有奏效 (Ubuntu))

(I found the solution here, an old problem from 2013: docker can't be uninstalled if it never worked (Ubuntu))

这篇关于无法在 WSL 上从 Ubuntu 卸载 Docker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆