kiford
kiford

Reputation: 1289

Docker service start failed

I have a CentOS 7.2 VM with Docker installed. Docker service and Docker container worked normally previously. But when I tried to pull a docker image, the VM was shutdown abruptly. After I restarted the VM, the Docker service could not be started:

[root@AY13091717064020986bZ ~]# service docker start
Redirecting to /bin/systemctl start  docker.service
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 output:

[root@AY13091717064020986bZ ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2016-08-23 19:11:19 CST; 13min ago
     Docs: http://docs.docker.com
  Process: 1404 ExecStart=/usr/bin/docker-current daemon --exec-opt native.cgroupdriver=systemd $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=1/FAILURE)
 Main PID: 1404 (code=exited, status=1/FAILURE)

Aug 23 19:11:17 AY13091717064020986bZ systemd[1]: Starting Docker Application Container Engine...
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.448828158+08:00" level=warning msg="devmapper: Usage of loopback devices is strongly discou...v section."
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511103592+08:00" level=error msg="[graphdriver] prior storage driver \"devicemapper\" faile...t status 2"
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511196844+08:00" level=fatal msg="Error starting daemon: error initializing graphdriver: de...t status 2"
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Failed to start Docker Application Container Engine.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Unit docker.service entered failed state.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

"journalctl -xe" output:

[root@AY13091717064020986bZ ~]# journalctl -xe
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: block manager: btree_node validator check failed for block 146
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: btree spine: node_check failed: csum 1600702373 != wanted 1600827965
Aug 23 19:11:19 AY13091717064020986bZ kernel: device-mapper: block manager: btree_node validator check failed for block 146
Aug 23 19:11:19 AY13091717064020986bZ kernel: Buffer I/O error on device dm-1, logical block 2621424
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511103592+08:00" level=error msg="[graphdriver] prior storage driver \"devicemapper\" failed: devmapper:
Aug 23 19:11:19 AY13091717064020986bZ docker-current[1404]: time="2016-08-23T19:11:19.511196844+08:00" level=fatal msg="Error starting daemon: error initializing graphdriver: devmapper: Base
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: Unit docker.service entered failed state.
Aug 23 19:11:19 AY13091717064020986bZ systemd[1]: docker.service failed.
Aug 23 19:11:19 AY13091717064020986bZ polkitd[1014]: Unregistered Authentication Agent for unix-process:1370:16052 (system bus name :1.22, object path /org/freedesktop/PolicyKit1/Authenticati
Aug 23 19:23:43 AY13091717064020986bZ systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has begun starting up.
Aug 23 19:23:43 AY13091717064020986bZ systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has finished starting up.
--
-- The start-up result is done.

Docker version:

[root@AY13091717064020986bZ ~]# docker version
Client:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.centos.10.x86_64
 Go version:      go1.6.3
 Git commit:      d381c64-unsupported
 Built:           Thu Aug  4 13:21:17 2016
 OS/Arch:         linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Linux kernel version:

[root@AY13091717064020986bZ ~]# uname -a
Linux AY13091717064020986bZ 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@AY13091717064020986bZ ~]#

CentOS version:

[root@AY13091717064020986bZ ~]# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID:    CentOS
Description:    CentOS Linux release 7.2.1511 (Core)
Release:    7.2.1511
Codename:    Core
[root@AY13091717064020986bZ ~]#

Upvotes: 66

Views: 297940

Answers (16)

גיא מזרחי
גיא מזרחי

Reputation: 1

I installed these, and the service started:

sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Upvotes: 0

Rm4n
Rm4n

Reputation: 858

Inspecting journalctl -xe revealed that there was no file such /usr/bin/dockerd as this is what the docker daemon is looking for. Strangely enough, sudo dockerd was just working fine. Running sudo which dockerd indicated that dockerd was indeed located at usr/sbin/dockerd. Linking /usr/bin/dockerd to /usr/sbin/dockerd solved the problem.

Upvotes: 0

bhojrajamrute
bhojrajamrute

Reputation: 161

You only need to reboot the server and check if your daemon.json file is correct.

By removing /etc/docker you will loose all Images and data.

you can check logs with

journalctl -u docker.service

Reboot server

sudo reboot

systemctl daemon-reload && systemctl enable docker && systemctl start docker

This worked for me.

Upvotes: 16

Reyhaneh Khalili
Reyhaneh Khalili

Reputation: 21

It works for me:

>  sudo update-alternatives --set iptables /usr/sbin/iptables-legacy

Upvotes: 0

theBird
theBird

Reputation: 61

I had this issue where i was downgrading the docker version. I clean uninstalled and was apt installing a specific version. Just remember to run

sudo apt update

Without the above, docker-ce wasn't being installed, which was causing this error

Process: 795828 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)

Ran apt install with the necessary versions i wanted and the docker is back to normal.

Upvotes: 0

zooblin
zooblin

Reputation: 2480

In my case it was empty daemon.json file, removing this file fixed it to me:

sudo rm -f /etc/docker/daemon.json
sudo systemctl start docker

Upvotes: 25

PKS
PKS

Reputation: 763

I was using docker desktop where In the settings I deleted everything in WSL_update_x64. It was not previously installed. So after installing it I deleted the files from the settings and It restarted itself.

Upvotes: 0

Innocent Anigbo
Innocent Anigbo

Reputation: 4777

I had a similar issue. This was how I fixed it permanently:

  • Delete everything in /var/lib/docker. This will delete existing container and images:
rm -rf /var/lib/docker
  • Then configure your daemon to use the "overlay" storage driver. Set the following flags in /etc/docker/daemon.json. If the file doesn't exist, just create it, and add the contents below:
{
    "graph": "/mnt/docker-data",
    "storage-driver": "overlay"
}

Now start Docker normally again and all should work fine and always.

See Start automatically at system boot.

Upvotes: 43

seqwait
seqwait

Reputation: 199

I had a similar issue. This was how I fixed it permanently:

mv etc/docker/daemon.json daemon.conf
systemctl daemon-reload
service docker restart

Upvotes: 5

Riaz Saifi
Riaz Saifi

Reputation: 51

dockerd saved my day, it shown iptables/firewalld missing. Installed the same and it worked like charm.

Upvotes: 3

Akshay
Akshay

Reputation: 41

Step1. Use 'dockerd' command to check the exact reason

[root@c7 docker]# dockerd
INFO[2020-06-03T11:27:50.293740882+05:30] Starting up
INFO[2020-06-03T11:27:50.298500541+05:30] parsed scheme: "unix"                         module=grpc
INFO[2020-06-03T11:27:50.298535150+05:30] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-06-03T11:27:50.298568308+05:30] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-06-03T11:27:50.298582671+05:30] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2020-06-03T11:27:50.305144487+05:30] parsed scheme: "unix"                         module=grpc
INFO[2020-06-03T11:27:50.305193838+05:30] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2020-06-03T11:27:50.305239948+05:30] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock 0  <nil>}] <nil>}  module=grpc
INFO[2020-06-03T11:27:50.305254274+05:30] ClientConn switching balancer to "pick_first"  module=grpc
failed to start daemon: error initializing graphdriver: /var/lib/docker contains several valid graphdrivers: overlay2, devicemapper; Please cleanup or explicitly choose storage driver (-s <DRIVER>)

Step2: remove overlay or devicemapper storage. Only 1 storage should exist

[root@c7 docker]# rm -rf devicemapper

Step3: Now start docker [root@c7 docker]# systemctl start docker

Step4: If you're getting below error

[root@c7 docker]# docker container ls

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Step5: Remove below file and restart docker

[root@c7 docker]# rm -rf /var/run/docker.pid
[root@c7 docker]# systemctl restart docker

Step6: You'll get back your images and running containers

Upvotes: 3

user12406106
user12406106

Reputation: 1

I've just removed all folders under /var/lib/docker and rebooted the server, that fixed the same problem in a rhel 7.7 system

That happened because I wanted to create a filsystem to be mounted on /var/lib/docker where images are allocated.

****Pay attention that it will also delete all your images, if you want to keep any just issue the docker save command

Upvotes: 0

yesnik
yesnik

Reputation: 4695

Only this command helped me to get the reason of this error:

dockerd

In the output I saw: Your Linux kernel version 2.6.32-042stab127.2 is not supported for running docker. Please upgrade your kernel to 3.10.0 or newer.

Upvotes: 153

Israel Perales
Israel Perales

Reputation: 2350

You only need delete the containers folder and reboot

sudo rm /var/lib/docker/containers/ -rf && sudo reboot

Upvotes: 5

jrheling
jrheling

Reputation: 313

I had a similar problem, which seems to have been caused by cruft left in /var/lib/docker from a previous installation.

Background details: I'd briefly used Docker from the CentOS extras repository; I had then removed it, installed the Docker repository, and installed docker-ce from that repository. This left /var/lib/docker behind and populated, but not owned by the docker-ce package.

The following fixed this:

  • rpm -e docker-ce
  • rm -f /var/lib/docker
  • yum install docker-ce

Upvotes: 1

Rodrigo
Rodrigo

Reputation: 454

I had a similar problem with an arch derived. After restarting all went well.

sudo shutdown -r now

then check with something like

systemctl status docker

Upvotes: 9

Related Questions