Docker: How to fix "Job for docker.service failed because the control process exited with error code"
Asked Answered
L

26

93

I'm trying to use docker in Manjaro (my kernel version is 4.19) and it is not working.

After running sudo pamac install docker I run sudo systemctl start docker.service and receive this message:

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

So sudo systemctl status docker.service returns:

● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2019-04-29 12:28:44 -03; 39s ago
     Docs: https://docs.docker.com
  Process: 17769 ExecStart=/usr/bin/dockerd -H fd:// (code=exited, status=1/FAILURE)
 Main PID: 17769 (code=exited, status=1/FAILURE)

abr 29 12:28:44 tamer-pc systemd[1]: docker.service: Service RestartSec=100ms expired, scheduling restart.
abr 29 12:28:44 tamer-pc systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
abr 29 12:28:44 tamer-pc systemd[1]: Stopped Docker Application Container Engine.
abr 29 12:28:44 tamer-pc systemd[1]: docker.service: Start request repeated too quickly.
abr 29 12:28:44 tamer-pc systemd[1]: docker.service: Failed with result 'exit-code'.
abr 29 12:28:44 tamer-pc systemd[1]: Failed to start Docker Application Container Engine.

and journalctl -xe returns:

-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The unit docker.service has entered the 'failed' state with result 'exit-code'.
abr 29 12:28:44 tamer-pc systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: A unidade docker.service falhou
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- A unidade docker.service falhou.
-- 
-- O resultado é failed.
abr 29 12:28:44 tamer-pc systemd[1]: docker.socket: Failed with result 'service-start-limit-hit'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The unit docker.socket has entered the 'failed' state with result 'service-start-limit-hit'.
abr 29 12:29:02 tamer-pc dbus-daemon[650]: [system] Activating via systemd: service name='org.freedesktop.resolve1' unit='>
abr 29 12:29:02 tamer-pc dbus-daemon[650]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.resolve1.>
abr 29 12:29:24 tamer-pc sudo[17879]:    tamer : TTY=pts/0 ; PWD=/etc/docker ; USER=root ; COMMAND=/usr/bin/systemctl stat>
abr 29 12:29:24 tamer-pc sudo[17879]: pam_unix(sudo:session): session opened for user root by (uid=0)
abr 29 12:29:24 tamer-pc sudo[17879]: pam_unix(sudo:session): session closed for user root
lines 1703-1725/1725 (END)

I'm looking for resolution for two days but whatever I read seems not to be exactly the same as my problem.

Lutz answered 29/4, 2019 at 15:32 Comment(6)
Try to start the docker daemon manually in debug mode and watch for any error messages: sudo dockerd --debugGeer
I run this command, this u can see the pastebin of output. Basically its got stop in the line API listen on /var/run/docker.sock, after 25 minutes i lost my patience and run ctrl+c. After I run sudo systemctl status docker.service and the output is different.Owenism
Lol actually now I run sudo systemctl start docker.serive and i got thisOwenism
try restarting network with sudo systemctl restart systemd-networkd.service then rebootMusician
This one might help https://mcmap.net/q/225663/-docker-service-failed-to-startHacking
I faced the same error, neither systemctl restart docker, nor linux reboot worked for me. the only clue to solve error was docker.service: Start request repeated too quickly . I ran the command sudo dockerd --debug it exactly showed the error point in /etc/docker/daemon.json config file. so I fixed the configuration and then start docker service solved the problem.Bellabelladonna
L
122

I really dont know what was happening, but I run sudo dockerd --debug like Zeitounator orients me, reboot my pc and docker works perfectly.

Lutz answered 29/4, 2019 at 22:3 Comment(8)
That's truly weird but rebooting works wonders. I installed docker on my Ubuntu 18.04 following the official manual.Cuckooflower
The command made me aware that my Linux kernel is too old for running Docker. [root@ubersmith-web docker]# dockerd --debug INFO[2020-08-12T03:53:32.984460717-04:00] Starting up DEBU[2020-08-12T03:53:32.984943597-04:00] Listener created for HTTP on unix (/var/run/docker.sock) FATA[2020-08-12T03:53:32.985099147-04:00] Your Linux kernel version 2.6.32.042stab140.1ovz is not supported for running docker. Please upgrade your kernel to 3.10.0 or newer.Radom
For me the error was: failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: modprobe: FATAL: Module ip_tables not found in directory /lib/modules/4.15.0-144-generic and the fix was apt-get install -y linux-modules-4.15.0-144-genericViva
Running dockerd --debug revealed a formatting issue with /etc/docker/daemon.json.Darnel
Yes, same worked for me. reboot worked!!Agminate
Run sudo dockerd --debug without reboot worked for meBallade
After # dockerd --debug I get information: unable to configure the Docker daemon with file /etc/docker/daemon.json: merged configuration validation from file and command line flags failed: the "graph" config file option is deprecated; use "data-root" instead I guess it's happen on docker 23.0.0 (debian package: docker-ce:5:23.0.0-0~debian.11~bullseye ). It fix after update daemon.json and restart daemon.Iulus
how did you guys even reach to that point? I got stuck on this "INFO[2023-03-23T19:38:15.021555465+08:00] API listen on /var/run/docker.sock "Uniocular
S
35

I had a similar issue when setting up Kubernetes on my local machine:

The error came up when I tried setting up Docker to use the OverlayFS storage driver.

I ran the following commands:

sudo systemctl stop docker
cp -au /var/lib/docker /var/lib/docker.bk

And then when I tried to start docker again using the command below:

sudo systemctl start docker

It was throwing the error:

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

Here's how I solved it:

I ran the command below to inspect the issue following Tâmer Pinheiro answer:

sudo dockerd --debug

And it gave me this information:

INFO[2020-09-02T11:46:15.272833297Z] Starting up                                  
DEBU[2020-09-02T11:46:15.273547501Z] Listener created for HTTP on unix (/var/run/docker.sock) 
failed to start daemon: Unable to get the TempDir under /var/lib/docker: mkdir
/var/lib/docker/tmp: no space left on device

I also checked the disk space of the server:

df -h

which showed that there was no space left on the drive (/dev/sda1 filesystem):

Filesystem      Size  Used Avail Use% Mounted on
udev            2.0G     0  2.0G   0% /dev
tmpfs           396M   12M  384M   4% /run
/dev/sda1       9.8G  9.8G     0 100% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock

tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs           396M     0  396M   0% /run/user/1000

And I realized that the issue had to do with no space left on device.

I had to run the following commands to clear some space for the filesystem:

sudo find /var/log -type f -delete
sudo rm -rf /var/cache/apt/*
sudo apt clean all

And then finally, I removed the /var/lib/docker.bk file, because it was too large for the 9.8GB filesystem of the server:

sudo rm -rf /var/lib/docker.bk

This time when I ran the command:

sudo systemctl restart docker

everything worked fine.

That's all.

I hope this helps

Sandfly answered 2/9, 2020 at 14:50 Comment(0)
W
16

I had the same problem, but I folow the advise of @Zeitounator, and I run this command sudo dockerd --debug to see the problem. It display this message :

Your Linux kernel version 2.6.32-042stab138.1 is not supported for running docker. Please upgrade your kernel to 3.10.0 or newer.

I've update my kernel and it works perfectly. I hope that help you !

Wirehaired answered 27/5, 2019 at 12:17 Comment(0)
F
8

For me,Stopping the VPN solved the problem

Feil answered 4/10, 2020 at 20:5 Comment(1)
wow, wouldnt have thought of this right away. Not sure why tho, only starting out with Docker atm.Marcelo
I
8

In my case it was a dangling comma in /etc/docker/daemon.json in the "dns" array/list. I simply removed the comma after the last entry and it worked.

Irriguous answered 2/12, 2020 at 11:33 Comment(1)
Similarly, I had an empty daemon.json file which also prevented Docker from starting.Possibly
P
8

Facing the same issue Three steps:

1:docker --debug to identify the issue it comes out to be network issue: Failed to program NAT chain: ZONE_CONFLICT: 'docker0' already bound to a zone

2: To resolved this Googled and found the command to run

firewall-cmd --zone=trusted --remove-interface=docker0

3: systemctl start docker

Parisi answered 18/6, 2021 at 12:16 Comment(1)
THANK YOU!!! I tried so many other methods for over an hour, from uninstalling all packages to rebooting, and this is the only solution that worked, thank you!Chemosh
C
5

I had a missing comma in my /etc/docker/daemon.json.

Cheremkhovo answered 25/2, 2022 at 15:8 Comment(1)
Same here, I had a wrong subnet digit: 192.168.0.0/166 is not valid because it should be 192.168.0.0/16 ;-)Dislimn
K
3

In my case, after Running dockerd --debug, it shows failed to start daemon: error initializing graphdriver: overlay2: unknown option overlay2.override_kernel_check: overlay2.

Cause: Docker supports several different graph drivers using a pluggable architecture. The preferred driver is overlay2 followed by overlay. However, Support for the overlay2.override_kernel_check storage option is removed from Docker v24.

Resolution: This storage option must be removed from the Docker daemon configuration in /etc/docker/daemon.json file.

The current file content:

{
        "storage-driver": "overlay2",
        "storage-opts": [
                "overlay2.override_kernel_check=true"
        ],
        "log-driver": "journald",
        "selinux-enabled": true
}

After removing the storage option:

{
        "storage-driver": "overlay2",
        "log-driver": "journald",
        "selinux-enabled": true
}

then execute systemctl restart docker and systemctl status docker.service, it shows active (running)

Kendo answered 8/6, 2023 at 3:4 Comment(0)
G
2

I followed various steps that lead me to this error. Then just restarted my PC and everything worked.

Giffie answered 6/8, 2019 at 6:47 Comment(0)
I
2

I had this problem and I assume it was because I had done a docker compose down and rebooted my machine before it was actually finished, so something got corrupted.

Since I couldn't use the daemon, I managed to follow the following steps to clean corrupted files without using the daemon. I got those snippets on a thread teaching how to completely uninstall docker from ubuntu.

sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo rm -rf /var/run/docker.sock
sudo systemctl restart docker
Instructions answered 14/11, 2023 at 17:32 Comment(0)
T
1

I got an error "Job for docker.service failed because the control process exited with error code." after installing the Docker on Centos 8. What helped me is:

yum install iptables
iptables -I INPUT -p tcp -m tcp --dport 8080 -j ACCEPT

Then I run "sudo systemctl start docker" with a success.

Tucci answered 26/2, 2021 at 9:18 Comment(0)
L
1

For me , I tried

sudo dockerd --debug

the last line error is

Error starting daemon: error while opening volume store metadata database: timeout

and I deleted the metadata, and it worked:

sudo mv /var/lib/docker/volumes/metadata.db /var/lib/docker/volumes/metadata.db.bk
Leggy answered 10/11, 2022 at 15:23 Comment(0)
S
1

After read the release notes, I undestand that my config must be update:

Remove the -g and --graph daemon options in favor of --data-root. https://github.com/docker/cli/pull/3739

Follow this docker community link

If this does not work try reboot and try again, We are doing all tha Jetson Nano Devices

Stave answered 27/3, 2023 at 9:51 Comment(0)
R
1

FWIW, I got this error when trying to upgrade docker-ce on my debian machine. Running dockerd --debug showed me that the issue was:

failed to start daemon: error initializing graphdriver: prior storage driver aufs is deprecated and will be removed in a future release; update the the daemon configuration and explicitly choose this storage drive
r to continue using it; visit https://docs.docker.com/go/storage-driver/ for more information

A bit of investigation at the supplied URL told me I needed to change my storage driver, so I edited /etc/docker/daemon.json to contain

{
  "storage-driver": "overlay2"
}

and then was able to successfully finish the upgrade of docker-ce.

Runt answered 20/4, 2023 at 16:10 Comment(0)
D
0

I also had the issue, and the debugging command provided by @Zeitounator helped a lot but didn't resolve the issue outright.

The problem turned out to be I didn't have IPTables installed on Centos, which Docker needs. I used the following walkthrough to install, start and test them and docker started no problem afterwards.

https://linuxize.com/post/how-to-install-iptables-on-centos-7/

Diaghilev answered 9/11, 2020 at 4:19 Comment(0)
S
0

For me, updating the kernel version and rebooting solved the issue.

Sarita answered 13/12, 2020 at 20:51 Comment(0)
D
0

For me, updating the firewalld solved the problem (personal sandbox, so i just outright disabled the firewall entirely).

Debauchee answered 25/3, 2021 at 19:42 Comment(0)
A
0

In my case changing the port in docker.service file works for me

file location /etc/systemd/system/multi-user.target.wants

port to change at this line ExecStart

Aurore answered 2/9, 2021 at 5:21 Comment(0)
R
0

I had this issue on Debian and I solved it by installing docker.io package - I previously saw in aptitude that it was recommended but not installed so I gave it a try.

Roath answered 11/10, 2021 at 11:14 Comment(0)
F
0

For me, the problem was that I had invalid json objects in my etc/init.d/daemon.json file, in my case it was

}
  ...
  "features" : {
    ...
    "buildkit" : true
  }
}

which I changed to

}
   "features" : {
     "buildkit" : true
  }
}

and then it worked.

Foremost answered 3/8, 2022 at 17:12 Comment(0)
D
0

What worked for me on Xero arc-based-linux distro.

  1. restart my pc after docker installation
  2. run the following command
    1. sudo systemctl status docker # inactive

    2. sudo systemctl start docker.service

    3. sudo systemctl status docker # active

hope this work for you.

Dalton answered 21/10, 2022 at 18:47 Comment(0)
M
0

In my case, I had to run dockerd --debug to see what the error was.

I found

failed to start daemon: Error initializing network controller: list bridge addresses failed: PredefinedLocalScopeDefaultNetworks List: [192.168.99.0/24]: no available network

Then I had to follow steps from here to solve it

Basically running,

ip link add name docker0 type bridge
ip addr add dev docker0 172.17.0.1/16

in a new terminal

Mirabella answered 5/1, 2023 at 16:14 Comment(0)
R
0

For me when I type

sudo dockerd --debug

I got:

unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: debug: (from flag: true, from file: true)

Solved it with following set of command:

sudo service firewalld stop
sudo service docker restart
sudo systemctl daemon-reload; systemctl restart docker
Radiant answered 22/1, 2023 at 7:39 Comment(0)
A
0

By using the command sudo dockerd --debug I saw this error in log

level=info msg="Removing stale sandbox 9b0bc67bba1eda3158e363112e6a6efc0cfac1ac42ddc4c17c4
dockerd[20306]: panic: assertion failed: write: circular dependency occurred

Circular dependencies can happen when there are interdependent relationships between Docker components or configurations that create an infinite loop, causing Docker to encounter this error. You can solve this by removing problematic container using

docker rm 9b0bc67bba1eda3158e363112e6a6efc0cfac1ac42ddc4c17c4

Or you can try removing all images and containers using this command. Use this with caution. As The command below will also remove volumes and networks.

sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker

Another way is to simply cd into the mentioned directories above and only remove containers folder.

Austerlitz answered 31/5, 2023 at 13:54 Comment(0)
R
0

In my case, I copy folder of docker into /user/bin and it not run. Just moving all docker/* into /user/bin

Ramsden answered 24/8, 2023 at 17:38 Comment(0)
T
0

In my case, after I run sudo dockerd --debug, everything work fine

enter image description here

However, I still don't start docker service

enter image description here

Here is my config:

  1. /etc/docker/daemon.json
{
    "data-root": "/home/test/Documents/docker",
    "storage-driver": "overlay2"
}
  1. /lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --data-root /home/test/Documents/docker

Tray answered 9/5 at 8:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.