Docker: How to fix "Job for docker.service failed because the control process exited with error code"
I really dont know what was happening, but I run sudo dockerd --debug
like Zeitounator orients me, reboot my pc and docker works perfectly.
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 !
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