37

I am new to Docker, so don't have much idea about it. I tried restarting Docker service using command

service docker restart

As the command was taking too much of time I did a CTL+C Now I am not able to start docker deamon Any docker command gives following op

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

I tried starting Docker deamon using

systemctl start docker

But it outputs:

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

Output of command

**systemctl status docker.service**

`● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─docker.conf, http-proxy.conf, https-proxy.conf
   Active: failed (Result: exit-code) since Mon 2018-03-05 17:17:54 IST; 2min 23s ago
     Docs: https://docs.docker.com
  Process: 11331 ExecStart=/usr/bin/dockerd --graph=/app/dockerRT (code=exited, status=1/FAILURE)
 Main PID: 11331 (code=exited, status=1/FAILURE)
   Memory: 76.9M
   CGroup: /system.slice/docker.service
           └─4593 docker-containerd-shim 3bda33eac892d14adda9f3b1fc8dc52173e26ce60ca949075227d903399c7517 /var/run/docker/libcontainerd/3bda33eac892d14adda9f3b1fc8dc52173e26c...
Mar 05 17:17:05 hj-fsbfsd9761.persistent.co.in systemd[1]: Starting Docker Application Container Engine...
Mar 05 17:17:05 hj-fsbfsd9761.persistent.co.in dockerd[11331]: time="2018-03-05T17:17:05.126009059+05:30" level=info msg="libcontainerd: new containerd process, pid: 11337"
Mar 05 17:17:06 hj-fsbfsd9761.persistent.co.in dockerd[11331]: time="2018-03-05T17:17:06.346599571+05:30" level=warning msg="devmapper: Usage of loopback devices is ...section."
Mar 05 17:17:10 hj-fsbfsd9761.persistent.co.in dockerd[11331]: time="2018-03-05T17:17:10.889378989+05:30" level=warning msg="devmapper: Base device already exists an...ignored."
Mar 05 17:17:10 hj-fsbfsd9761.persistent.co.in dockerd[11331]: time="2018-03-05T17:17:10.976695025+05:30" level=info msg="[graphdriver] using prior storage driver \"...mapper\""
Mar 05 17:17:54 hj-fsbfsd9761.persistent.co.in dockerd[11331]: time="2018-03-05T17:17:54.312812069+05:30" level=fatal msg="Error starting daemon: timeout"
Mar 05 17:17:54 hj-fsbfsd9761.persistent.co.in systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Mar 05 17:17:54 hj-fsbfsd9761.persistent.co.in systemd[1]: **Failed to start Docker Application Container Engine.**
Mar 05 17:17:54 hj-fsbfsd9761.persistent.co.in systemd[1]: Unit docker.service entered failed state.
Mar 05 17:17:54 hj-fsbfsd9761.persistent.co.in systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

journalctl -xe loop: Write error at byte offset 63585648640, length 4096.

How would I be able to start Docker without losing any containers and using previous configurations?

Dhanu K
  • 11,288
  • 6
  • 24
  • 38
Ashish Prabhune
  • 451
  • 2
  • 5
  • 6

7 Answers7

43

I had the same issue (Fedora 30 x86_64, kernel 5.2.9) and it turned out that being connected to a VPN was the problem. Apparently having a changed gateway address causes an "Error initializing network controller" error which I was able to see when I tried starting docker via sudo dockerd instead of sudo systemctl start docker.

I found the note here about the VPN being a possible problem, disconnecting immediately allowed me to start docker with systemctl start docker.

Dusty Vargas
  • 863
  • 6
  • 17
  • 5
    I couldn't get Docker to start. I had a VPN on. After reading this, I turned it off and Docker worked straight away. – Biggsy Sep 26 '19 at 11:07
  • 2
    Fixed mine too. Is there any workaround to prevent VPN interference with the Docker? – Yoones Mehdian Mar 29 '21 at 19:45
  • The interference seems to be bidirectional. In my case, the VPN function was not stable until the docker network interface was brought down with the command `sudo ifconfig docker0 down` (I wasn't running docker and didn't need to). Telling from the routing table, I guess docker and VPN are racing to be the gateway of destination `172.17.x.x`. – Zhiyong Jul 02 '21 at 15:45
32

"Failed to start Docker Application Container Engine" is a general error message. You should inspect journal for more details:

journalctl -eu docker

In my case it was: "error initializing graphdriver: /var/lib/docker contains several valid graphdrivers: devicemapper, overlay2"

Changing graphdriver to overlay2, fixed it:

$ sudo systemctl stop docker
$ vi /etc/docker/daemon.json # Create the file if it does not exist, and add:

{
  "storage-driver": "overlay2"
}

$ sudo systemctl start docker
$ systemctl status docker.service # Hopefully it's running now
Noam Manos
  • 15,216
  • 3
  • 86
  • 85
12

I removed the file /etc/docker/daemon.json and started it with sudo systemctl start docker and it worked!!

srigu
  • 329
  • 1
  • 5
  • 16
4

For the googlers:

For me what worked was doing a killall dockerd and a sudo rm /var/run/docker.pid

I got the error message that recommended that from running dockerd

Zeor137
  • 165
  • 1
  • 2
  • 11
2

I ran into this too but all I did after receiving the error was sudo systemctl start docker and then ran sudo systemctl status docker again and that took care of it while on a vpn.

d_Tov
  • 29
  • 1
1

You may have the issue with the current docker installation.

If you don't have much done already you may want to try to reinstall using the install script provided by Docker: https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-convenience-script this will help you to investigate the errors.

AI Mechanic
  • 631
  • 7
  • 8
0

I faced the same problem, in my case the disk was full. I removed docker volumes from /var/lib/docker/volumes/ and started docker with sudo systemctl start docker.

ABBAS mhs
  • 99
  • 6