Ubuntu 20.04 上的 docker-ce 安装后配置失败

unl*_*kme 2 apt docker 20.04

我将我的 Ubuntu 从 18.04 升级到 20.04。我一直无法运行我所有的 docker 容器。尝试卸载 docker 并通过诸如此类的链接重新安装。使用 apt 时,安装冻结在 docker 的配置上。安装无法启动docker。

最终,它似乎归结为配置问题。

 user@user-pc:~$ sudo dpkg --configure -a
 Setting up docker-ce (5:20.10.1~3-0~ubuntu-focal) ... 
 /bin/sh: 0: Illegal option -w
 dpkg: error processing package docker-ce (--configure):
 installed docker-ce package post-installation script subprocess returned error exit status-2
 dpkg: dependency problems prevent configuration of docker-ce-rootless-extras:
 docker-ce-rootless-extras depends on docker-ce; however:
 Package docker-ce is not configured yet.

 dpkg: error processing package docker-ce-rootless-extras (--configure):
 dependency problems - leaving unconfigured
 Processing triggers for man-db (2.9.1-1) ...
 Errors were encountered while processing:
 docker-ce
 docker-ce-rootless-extras
Run Code Online (Sandbox Code Playgroud)

码头工人状态

sudo service docker status
Run Code Online (Sandbox Code Playgroud)

显示 docker 处于活动状态,但任何 docker 命令永远挂起。还docker-compose命令超时。

docker-compose logs -f 
...
...
docker.errors.DockerException: Error while fetching server API version: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
Run Code Online (Sandbox Code Playgroud)

我很难过,一直在努力解决这个问题,三天了。

小智 7

安装 docker 时是否有 VPN 在后台运行?

显然,隧道你的网络[while installing docker leads to problems][1]。它也发生在我身上。通过关闭openvpn

须藤服务 openvpn 停止

并且 docker 安装得很漂亮。


小智 6

我有类似的问题。Ubuntu从18.04.4升级到20.04.2后,docker无法启动,并且在尝试安装、删除、清除、修复时出错。(VPN 不在我的控制范围内)。

$ sudo apt-get purge -y docker-ce
...
1 not fully installed or removed.
...
Removing docker-ce (5:20.10.4~3-0~ubuntu-bionic) ...
Job for docker.service canceled.
invoke-rc.d: initscript docker, action "stop" failed.
dpkg: error processing package docker-ce (--remove):
 installed docker-ce package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
dpkg: error while cleaning up:
 installed docker-ce package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 docker-ce
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)

我安装了来自 Debian/Ubuntu 的 docker.io 和来自 docker.com 的 docker-ce。这篇文章讨论了这些差异。

dpkg -l | grep -i docker
Run Code Online (Sandbox Code Playgroud)

对我来说,它令人窒息containerd,无法启动。您可以在以下位置查看消息/var/log/syslog

删除文件夹、卸载所有 docker 软件包并重新安装 docker.io 有效。

注意:我不关心以前的图像或容器,如果你这样做,那么这可能不适合你。

$ sudo rm -rf /var/lib/containerd/
$ sudo rm -rf /var/lib/docker/
$ sudo apt-get purge -y docker-ce docker-ce-cli docker.io containerd.io
$ sudo apt-get install docker.io
Run Code Online (Sandbox Code Playgroud)