5

I upgraded my Ubuntu from 18.04 to 20.04. I have been unable to run all my docker containers. Tried uninstalling docker and re-installing via links such as this. When using apt, the installation freezes on the configuration of docker. The installation is not able to start docker.

Eventually, it seems to boil down to a configuration problem.

 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

The docker status

sudo service docker status

Shows that docker is active but any docker command hangs forever. Also docker-compose commands timeout.

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

I am stumped, been trying to resolve this, three days now.

3 Answers 3

16

Do you have a VPN running in the background while installing docker?

Apparently, tunneling your network [while installing docker leads to problems][1]. It just happened to me as well. Turned off openvpn via

sudo service openvpn stop

and docker installed beautifully.

3
  • It happen on 20.04 too. Really thanks, turned off openconnect and the error not happen again. Jan 13, 2021 at 18:39
  • Same happended to me. Disable VPN before installing worked for me! Thanks
    – jobima
    Feb 5, 2021 at 11:45
  • temporarily turning off tailscale fixed this issue, thanks!
    – asg0451
    Jan 15 at 3:09
3

I had a similar issue. After Ubuntu upgrade from 18.04.4 to 20.04.2 docker would not start, and errored when trying to install, remove, purge, repair it. (VPN is outside of my control).

$ 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)

I had both docker.io from Debian/Ubuntu and docker-ce from docker.com installed. This post discusses the differences.

dpkg -l | grep -i docker

Looks for me it was choking on containerd which would not start. You can check messages in /var/log/syslog

Removing folders, uninstalling all docker packages and reinstalling docker.io worked.

NOTE: I did not care about previous images or containers, if you do then this might NOT work for you.

$ 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
2
  • this works for me. Thanks
    – thsieh
    Feb 24, 2022 at 22:17
  • 1
    I had what sounds like the same issue with containerd not starting, and it was "out of the blue" in my case. This occurred on an Ubuntu 20.04 LTS installation inside WSL2 on Windows 10 21H2. Windows Updates have butchered my WSL installation before, and one was installed just prior to this problem occurring, so I remain suspicious! Your instructions worked great (but I had to kill some lingering Docker-related processes before I could delete the directories). Thanks! Dec 15, 2022 at 17:52
1

Updating { "storage-driver": "devicemapper" }

in daemon.json and restarting docker service solved this problem.

nano /etc/docker/daemon.json
#Add 
{ "storage-driver": "devicemapper" }
#Save and exit

restart docker service.

Referred this from issue link https://github.com/moby/moby/issues/22685

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.