docker-ce post installation subprocess never finishes
I tried installing docker-ce
following the instructions provided in the official Docker Documentation using the repository. The installation got stuck at this point:
Setting up docker-ce (17.09.0~ce-0~ubuntu) ...
insserv: warning: script 'K01postgresql-9.5' missing LSB tags and overrides
insserv: warning: script 'postgresql-9.5' missing LSB tags and overrides
After waiting for a very long time I interrupted the process with sudo killall apt-get
. Now, whenever I try using a command that uses apt-get it will say the following:
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
When I run that command it just starts running the original command that never finishes. At this point, I just want to solve this without even being able to run Docker (I just wanted to try it out).
I already tried most answers for this related question. I can't even use sudo apt-get remove docker-ce
because I run into the same problem.
Some info on the docker installation:
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e
Drop-In: /etc/systemd/system/docker.service.d
└─ubuntu.conf
Active: activating (start) since mié 2017-11-22 15:38:31 CST; 7min ago
Docs: https://docs.docker.com
Main PID: 1431 (docker)
Tasks: 6
Memory: 18.4M
CPU: 21ms
CGroup: /system.slice/docker.service
└─1431 /usr/bin/docker -d -H fd://
docker-ce:
Installed: 17.09.0~ce-0~ubuntu
Candidate: 17.09.0~ce-0~ubuntu
Version table:
*** 17.09.0~ce-0~ubuntu 100
100 /var/lib/dpkg/status
I'm running Ubuntu 16.04
It appears that docker-ce
is hanging on service start:
\_ apt install docker-ce
\_ /usr/bin/dpkg --status-fd 64 --configure --pending
\_ /bin/sh /var/lib/dpkg/info/docker-ce.postinst configure
\_ /bin/sh /usr/sbin/invoke-rc.d docker start
\_ systemctl start docker.service
\_ /bin/systemd-tty-ask-password-agent --watch
Killing systemctl start docker.service
process should be enough:
sudo kill -9 $(ps aux | grep "systemctl start docker.service" | head -n 1 | awk '{print $2}')
check systemd jobs:
sudo systemctl list-jobs
JOB UNIT TYPE STATE
2831057 docker.service start running
if any docker job is running, kill it:
sudo systemctl kill docker.service
Make sure to verify that you don't have any overrides defined:
/etc/systemd/system/docker.service.d/
e.g. overriding command to (used in 17.03
release):
ExecStart=/usr/bin/docker daemon
instead of /usr/bin/dockerd
. Before continuing be sure to kill any remaining docker process:
ps aux | grep "[d]ockerd"
stop remaining Docker daemon process (if there's any):
sudo kill -9 $(ps aux | grep "[d]ockerd" | head -n 1 | awk '{print $2}')
If you're upgrading from previous docker version (docker.io
, docker-engine
etc.) or just changing underlying file storage, it's safer to delete all docker data before installing new version.
sudo rm -rf /var/lib/docker
sudo apt install docker-ce
To fix broken installation, just run sudo dpkg --configure -a
and docker.service
should start.
I faced the same problem, here are all steps which I did to completely remove docker. I hope it'll help
Stoping docker services
service docker stop
Removing locks, after interupted installation
rm /var/lib/dpkg/lock
Restoring
dpkg --configure -a
If dpkg stuck, from different terminal stop the docker service
service docker stop
Removing all docker packages and cleaning
apt-get remove docker docker-engine docker.io docker-ce
apt-get purge docker docker-engine docker.io docker-ce
apt-get autoremove
apt-get autoclean
Remove all docker related files
rm -rf /lib/systemd/system/docker.service
rm -rf /etc/docker
rm -rf /var/lib/docker
rm -rf /run/docker.sock
rm -rf /etc/systemd/system/docker.service.d
Optional, updating packages
apt-get update / upgrade / dist-upgrade
Rebooting
reboot
I had this same issue yesterday. I did a server reboot:
sudo reboot
and reconfigured packages:
sudo dpkg --configure -a
And issue was solved.