59

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 ~]#
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
kiford
  • 1,219
  • 1
  • 12
  • 23
  • did try to re-install docker? – vitr Aug 23 '16 at 12:26
  • can you try to restart the service - service docker restart? – Bhavesh Aug 23 '16 at 12:47
  • This problem was not occurred the first time, I removed the /var/lib/docker and re-pulled all images and it worked when it occurred the first time. I could not always do this way, I want to find a method to solve it ultimately. @Bhavesh : output of restart is the same as start. – kiford Aug 23 '16 at 13:07

16 Answers16

127

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.

yesnik
  • 4,085
  • 2
  • 30
  • 25
43

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.

Brad Parks
  • 66,836
  • 64
  • 257
  • 336
Innocent Anigbo
  • 4,435
  • 1
  • 19
  • 19
18

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
zooblin
  • 2,172
  • 2
  • 27
  • 33
  • In mycase, the previous developer installed docker v4 on centOS 7, then I tried to install docker-compose. but it said no docker daemon (no docker.service,docker.socket or containerd.service files in system directory) . Even could not restart the docker service, there was no docker service,but basic docker commands worked. Then, I upgraded docker version to latest (v 23). The every image,container has gone. finally, i tried this answer and it worked.! – Ke_Sandaru Jun 10 '23 at 18:40
14

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.

bhojrajamrute
  • 141
  • 1
  • 3
8

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
Rodrigo
  • 394
  • 4
  • 7
5

You only need delete the containers folder and reboot

sudo rm /var/lib/docker/containers/ -rf && sudo reboot
Israel Perales
  • 2,192
  • 2
  • 25
  • 30
5

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
seqwait
  • 159
  • 1
  • 7
2

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

Piotr Labunski
  • 1,638
  • 4
  • 19
  • 26
Akshay
  • 31
  • 2
2

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

Riaz Saifi
  • 41
  • 1
  • 3
    Several other answers already suggest using `dockerd`. Please don't post duplicate answers and/or comments to other answers. – Eric Aya Feb 03 '21 at 12:11
  • upvoting because I saw this answer first and it helped me (was issue - iptables not installed) – eja Feb 24 '21 at 16:11
1

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
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jrheling
  • 153
  • 1
  • 8
0

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

0

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.

PKS
  • 618
  • 1
  • 7
  • 19
0

I installed this and the service started.

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

0

It works for me:

>  sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
Preet Sangha
  • 64,563
  • 18
  • 145
  • 216
0

Inspecting xournalctl -xe revealed that there was no file such /usr/bin/dockerd as this is what 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.

Rm4n
  • 623
  • 7
  • 14
0

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.

theBird
  • 31
  • 3