无法卸载 docker-ce (并且无法安装任何新程序)

asu*_*rem 5 ubuntu docker windows-subsystem-for-linux

我搞乱了 WSL Linux (Ubuntu 16.04.5 LTS) 上的 docker 安装。我尝试卸载它,但它拒绝让步。以下是问题:

\n\n

首先检查docker是否存在:

\n\n
$ dpkg -l | grep -i docker\npFR docker-ce                            5:18.09.4~3-0~ubuntu-xenial                amd64        Docker: the open-source application container engine\n
Run Code Online (Sandbox Code Playgroud)\n\n

尝试删除 docker-ce:

\n\n
$ sudo apt-get purge -y docker-ce\nReading package lists... Done\nBuilding dependency tree\nReading state information... Done\nThe following packages will be REMOVED:\n  docker-ce*\n0 upgraded, 0 newly installed, 1 to remove and 146 not upgraded.\n1 not fully installed or removed.\nAfter this operation, 85.4 MB disk space will be freed.\ndpkg: error processing package docker-ce (--purge):\n package is in a very bad inconsistent state; you should\n reinstall it before attempting a removal\nErrors were encountered while processing:\n docker-ce\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n
Run Code Online (Sandbox Code Playgroud)\n\n

还有致命一击 - 尝试安装任何新程序:

\n\n
$ sudo apt-get install sysvbanner\nReading package lists... Done\nBuilding dependency tree\nReading state information... Done\nYou might want to run 'apt-get -f install' to correct these:\nThe following packages have unmet dependencies:\n docker-ce : Depends: docker-ce-cli but it is not going to be installed\n             Depends: containerd.io (>= 1.2.2-3) but it is not going to be installed\n             Recommends: aufs-tools but it is not going to be installed\n             Recommends: cgroupfs-mount but it is not going to be installed or\n                         cgroup-lite but it is not going to be installed\n             Recommends: pigz but it is not going to be installed\nE: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).\n
Run Code Online (Sandbox Code Playgroud)\n\n

并尝试按照建议修复安装apt-get -f install

\n\n
$ sudo apt-get -f install\nReading package lists... Done\nBuilding dependency tree\nReading state information... Done\nCorrecting dependencies... Done\nThe following additional packages will be installed:\n  containerd.io docker-ce-cli\nThe following NEW packages will be installed:\n  containerd.io docker-ce-cli\n0 upgraded, 2 newly installed, 0 to remove and 146 not upgraded.\n1 not fully installed or removed.\nNeed to get 0 B/50.3 MB of archives.\nAfter this operation, 157 MB of additional disk space will be used.\nDo you want to continue? [Y/n] y\nSelecting previously unselected package docker-ce-cli.\n(Reading database ... 69776 files and directories currently installed.)\nPreparing to unpack .../docker-ce-cli_5%3a18.09.4~3-0~ubuntu-xenial_amd64.deb ...\nUnpacking docker-ce-cli (5:18.09.4~3-0~ubuntu-xenial) ...\nSelecting previously unselected package containerd.io.\nPreparing to unpack .../containerd.io_1.2.5-1_amd64.deb ...\nUnpacking containerd.io (1.2.5-1) ...\nProcessing triggers for man-db (2.7.5-1) ...\nSetting up docker-ce-cli (5:18.09.4~3-0~ubuntu-xenial) ...\nSetting up containerd.io (1.2.5-1) ...\ndpkg: error processing package docker-ce (--configure):\n package is in a very bad inconsistent state; you should\n reinstall it before attempting configuration\nErrors were encountered while processing:\n docker-ce\nE: Sub-process /usr/bin/dpkg returned an error code (1)\n
Run Code Online (Sandbox Code Playgroud)\n\n

请。半停。如果我这么不正式就好了。

\n

风声猎*_*声猎猎 -2

我用以下命令解决了这个问题:

sudo apt-get install docker-ce
sudo apt-get purge docker docker.io docker-ce
sudo apt autoremove
Run Code Online (Sandbox Code Playgroud)

然后我可以安装新程序:

sudo apt-get install php -y
Run Code Online (Sandbox Code Playgroud)