我把WSL Linux (Ubuntu 16.04.5 LTS)上的docker安装搞砸了。我尝试卸载它,但是它不愿意动。以下是问题:
首先检查是否存在docker:
$ dpkg -l | grep -i docker
pFR docker-ce 5:18.09.4~3-0~ubuntu-xenial amd64 Docker: the open-source application container engine
尝试删除 Docker-ce:
$ sudo apt-get purge -y docker-ce
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 146 not upgraded.
1 not fully installed or removed.
After this operation, 85.4 MB disk space will be freed.
dpkg: error processing package docker-ce (--purge):
package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
最后的致命一击——尝试安装任何新程序:
$ sudo apt-get install sysvbanner
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
docker-ce : Depends: docker-ce-cli but it is not going to be installed
Depends: containerd.io (>= 1.2.2-3) but it is not going to be installed
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not going to be installed or
cgroup-lite but it is not going to be installed
Recommends: pigz but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
尝试按照建议使用apt-get -f install
来修复安装问题:
$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
containerd.io docker-ce-cli
The following NEW packages will be installed:
containerd.io docker-ce-cli
0 upgraded, 2 newly installed, 0 to remove and 146 not upgraded.
1 not fully installed or removed.
Need to get 0 B/50.3 MB of archives.
After this operation, 157 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package docker-ce-cli.
(Reading database ... 69776 files and directories currently installed.)
Preparing to unpack .../docker-ce-cli_5%3a18.09.4~3-0~ubuntu-xenial_amd64.deb ...
Unpacking docker-ce-cli (5:18.09.4~3-0~ubuntu-xenial) ...
Selecting previously unselected package containerd.io.
Preparing to unpack .../containerd.io_1.2.5-1_amd64.deb ...
Unpacking containerd.io (1.2.5-1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up docker-ce-cli (5:18.09.4~3-0~ubuntu-xenial) ...
Setting up containerd.io (1.2.5-1) ...
dpkg: error processing package docker-ce (--configure):
package is in a very bad inconsistent state; you should
reinstall it before attempting configuration
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)
请帮忙。如果我这么称呼不太正式的话。