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
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://

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

5 Answers 5


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:


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.

  • systemctl shows docker.service running. However, it is still running after running the kill command. Same with bin/docker process. /etc/systemd/system/docker.service.d/ubuntu.conf has the following: [Service]\n # workaround to include default options\n EnvironmentFile=/etc/default/docker\n ExecStart=\n ExecStart=/usr/bin/docker -d -H fd:// $DOCKER_OPTS\n I don't really understand what this is doing. (added the \n to show line breaks)
    – Franco
    Apr 1, 2018 at 16:29
  • @Franco you should remove the /etc/systemd/system/docker.service.d/ubuntu.conf. Generally configuration in /etc/systemd/system overrides configuration provided by package. There were several breaking changes in Docker packaging, so it should be safer to remove those overrides.
    – Tombart
    Apr 3, 2018 at 16:04
  • there's a little caveat with your yommands: ps aux | grep "bin/docker" finds the grep process itself. But in the end, sudo rm -rf /var/lib/docker did the trick - thanks!
    – xeruf
    May 6, 2018 at 19:10
  • @Xerus You're right, I've updated the answer to make it clear, that we're killing dockerd process.
    – Tombart
    May 7, 2018 at 7:18

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


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



I had this same issue yesterday. I did a server reboot:

sudo reboot

and reconfigured packages:

sudo dpkg --configure -a

And issue was solved.


It looks like that you have problems on postgresql-9.5 package, I'll try to install docker-ce after I purged that package. Also there is a new version of docker-ce package available (17.12).


I had exactly the same problem and just solved it as follows (origin of my problem was update to docker from older version to latest):

1.- Stop docker service (which is trying to start w wrong daemon command): systemctl stop docker.service

2.- Modify docker daemon command syntax in (which changed from old to latest version): /etc/systemd/system/docker.service.d/50-docker_dns.conf from: ExecStart=/usr/bin/docker daemon ... to: ExecStart=/usr/bin/dockerd ...

3.- Restart docker daemon so that new config gets loaded: systemctl start docker.service

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .