49

I have followed the installation instructions of Docker CE for CentOS. Initially this worked. At some point the system was restarted and now starting Docker fails. Appreciate expert eyes on this matter...

systemctl start docker produces:

Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

systemctl status docker.service produces:

Apr 21 11:25:23 sec-services-build-1 systemd[1]: Starting Docker Application Container Engine...
Apr 21 11:25:23 sec-services-build-1 dockerd[9693]: time="2017-04-21T11:25:23.370390797+03:00" level=info msg="libcontainerd: previous instance of containerd still alive (8908)"
Apr 21 11:25:23 sec-services-build-1 dockerd[9693]: time="2017-04-21T11:25:23.382492171+03:00" level=warning msg="overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type support will no longer be supported in Docker 17.12."
Apr 21 11:25:23 sec-services-build-1 dockerd[9693]: time="2017-04-21T11:25:23.382547668+03:00" level=info msg="[graphdriver] using prior storage driver: overlay"
Apr 21 11:25:24 sec-services-build-1 dockerd[9693]: Error starting daemon: error while opening volume store metadata database: timeout
Apr 21 11:25:24 sec-services-build-1 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Apr 21 11:25:24 sec-services-build-1 systemd[1]: Failed to start Docker Application Container Engine.
Apr 21 11:25:24 sec-services-build-1 systemd[1]: Unit docker.service entered failed state.
Apr 21 11:25:24 sec-services-build-1 systemd[1]: docker.service failed.
3
  • see also github.com/moby/moby/issues/31600 do you share /var/lib/docker between multiple daemons? Commented Apr 21, 2017 at 8:43
  • The honest answer is: I don't know. I don't think so... it's a pretty much untouched machine.
    – Idan Adar
    Commented Apr 21, 2017 at 8:44
  • 1
    I wouldn't mind even to simply be able to uninstall Docker and reinstall, which didn't work either... sigh.
    – Idan Adar
    Commented Apr 21, 2017 at 8:46

5 Answers 5

115

From here: https://github.com/moby/moby/issues/22507

I ran:

ps axf | grep docker | grep -v grep | awk '{print "kill -9 " $1}' | sudo sh 

I was then able to restart docker using:

sudo systemctl start docker
5
  • 1
    How to restart docker ?
    – vijay
    Commented Sep 14, 2017 at 5:13
  • @vijay: not sure how you installed it, but I use this: sudo systemctl start docker.
    – Idan Adar
    Commented Oct 9, 2017 at 11:26
  • 1
    I also had to reboot my machine as there were many defunct processes [dockerd] <defunct>
    – vikas027
    Commented Feb 7, 2018 at 10:26
  • @vijay To restart docker: sudo systemctl restart docker
    – LobsterBaz
    Commented Apr 30, 2021 at 21:22
  • See my answer on the ticket to unmount netns and overlayfs as well as disable autostart on containers while docker is off.
    – dagelf
    Commented Aug 15, 2021 at 9:23
9

Step 1: systemctl status docker (if docker is running) stop the docker.

step 2: systemctl stop docker.

step 3: dockerd

2
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Feb 16, 2022 at 11:00
  • In the case where dockerd did not initially work, this solution fixed it
    – Valentin
    Commented May 3 at 13:23
8

i got this message when copying volumes from production machine, ended up to overwrite metadata.db inside /var/lib/docker/volumes, then it crashes. A fix is so simple

docker system prune --volumes -f && rm /var/lib/docker/volumes/metadata.db && docker-compose up -d
1
  • 1
    removing the folder was enough for me Commented Mar 11, 2023 at 0:26
3

I encountered the same error.

❶tried

sudo kill -9 1452

multiple times, but it doesn't work. There's still a dockerd process active.

 1452 ?        Zsl  127:42 [dockerd] <defunct>

❷tried as @Artur Mustafin suggested:

sudo mv /var/lib/docker/volumes/metadata.db /var/lib/docker/volumes/metadata.db.bk

it worked.

0

so I tried all of these and nothing worked. However what worked was removing all the containers from /var/lib/docker/containers. Then i killed all docker processes (ps -ef | grep docker) then restarted docker and the docker socket. When docker became active I added the containers one at a time and 1 container was what caused the issues

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