I am trying to push a docker image and noticed that my docker daemon actually is probably not running.
If for example I run:
docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
If I try to restart the daemon using:
systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
Continuing running:
systemctl status docker.service
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: failed (Result: start-limit-hit) since Wed 2021-05-12 14:45:09 EEST; 43s ago
Docs: https://docs.docker.com
Process: 4810 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE) Main PID: 4810 (code=exited, status=1/FAILURE)May 12 14:45:07 iti-554 systemd[1]: docker.service: Unit entered failed state.
May 12 14:45:07 iti-554 systemd[1]: docker.service: Failed with result 'exit-code'.
May 12 14:45:09 iti-554 systemd[1]: docker.service: Service hold-off time over, scheduling restart.
May 12 14:45:09 iti-554 systemd[1]: Stopped Docker Application Container Engine.
May 12 14:45:09 iti-554 systemd[1]: docker.service: Start request repeated too quickly.
May 12 14:45:09 iti-554 systemd[1]: Failed to start Docker Application Container Engine.
May 12 14:45:09 iti-554 systemd[1]: docker.service: Unit entered failed state.
May 12 14:45:09 iti-554 systemd[1]: docker.service: Failed with result 'start-limit-hit'.
which as I understand it it means docker daemon is not loaded (it's in a failed state) and the last reason for this is the start-limit-hit has been reached. This on this side probably means another reason exists for this to happen.
SO, how do I find out which is the actual reason for my docker daemon refusing to start?
If I run to reset the failed attemps counter with:
systemctl reset-failed docker.service
it return without error so I assume it succeeds. And indeed when I check the status it has become:
Active: inactive (dead) since Wed 2021-05-12 14:45:09 EEST; 14min ago
Of course if I run docker daemon again it fails.
Can someone provide any workaround about this issue? I even tried to invoke the commands after restarting (didn't help).
Edit
Well, to my case the problem was a rather stupid one. I had added a daemon.json
file with minimal content in it. Just this:
cat /etc/docker/daemon.json
{
"insecure-registries": [
"docker-server.com:10022",
"docker-server.com:10023"
],
}
The problem was that the dangling comma before }
made docker search for another parameter. The relevant message shown using journalctl -u docker
was:
unable to configure the Docker daemon with file /etc/docker/daemon.json: invalid character '}' looking for beginning of object key string
is quite obvious but the previous ones did not help much.
journalctl -u docker
gives you docker daemon logs. Maybe u can find something there. Include the output in your question by editing it. – p10l