【问题标题】:Cant uninstall Docker from Ubuntu on WSL无法在 WSL 上从 Ubuntu 卸载 Docker
【发布时间】:2023-03-24 09:16:02
【问题描述】:

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

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)

我希望任何人都可以帮助我。 :)

【问题讨论】:

    标签: docker ubuntu-16.04 windows-subsystem-for-linux


    【解决方案1】:

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

    在我的情况下,我 sudo 编辑了 /var/lib/dpkg/info/docker.io.prerm 并将 /sbin/stop docker (失败)替换为 true (仅返回成功)。之后, apt remove docker.io 完美运行。

    (我在这里找到了解决方案,2013 年的一个老问题:docker can't be uninstalled if it never worked (Ubuntu)

    【讨论】:

    • 这对我有用。略有不同的是我需要替换的行是invoke-rc.d docker stop
    • 问题是Docker当前假设如果init脚本存在,则守护进程必须在运行。话虽如此,目前.prerm文件的唯一目的是停止docker,所以你可以删除/var/lib/dpkg/info/docker-ce.prerm然后正常卸载。
    【解决方案2】:

    我在删除 docker 包 docker-ce docker-ce-cli 时遇到了同样的错误。基本上 docker 服务没有在我的机器上运行,这就是为什么我想完全删除它并重新安装。由于 docker 服务从未运行,脚本 /var/lib/dpkg/info/docker-ce.prerm 未能停止 docker 服务。删除此检查效果很好..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-01
      • 2017-10-15
      • 1970-01-01
      • 1970-01-01
      • 2023-01-03
      • 2015-10-30
      • 2020-10-06
      • 2014-05-19
      相关资源
      最近更新 更多