[Solved] Docker service fail to start after update

Hello :wave:

This morning, I update my docker installation on ubuntu 22.04 to version 23.0.0.

I have a configuration to use another partition for my docker stuff, and I update my /usr/lib/systemd/system/docker.service:

ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

to

ExecStart=/usr/bin/dockerd -g /home/docker -H fd:// --containerd=/run/containerd/containerd.sock

And when I start docker.service after systemctl daemon-reload, there is this message:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

And systemctl status docker.service:

Ă— docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2023-02-03 15:36:28 CET; 24min ago
TriggeredBy: Ă— docker.socket
       Docs: https://docs.docker.com
    Process: 9448 ExecStart=/usr/bin/dockerd -g /home/docker -H fd:// --containerd=/run/containerd/containerd.sock (code=exited,>
   Main PID: 9448 (code=exited, status=1/FAILURE)
        CPU: 70ms

févr. 03 15:36:28 laurent-ubuntu-5 systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
févr. 03 15:36:28 laurent-ubuntu-5 systemd[1]: Stopped Docker Application Container Engine.
févr. 03 15:36:28 laurent-ubuntu-5 systemd[1]: docker.service: Start request repeated too quickly.
févr. 03 15:36:28 laurent-ubuntu-5 systemd[1]: docker.service: Failed with result 'exit-code'.
févr. 03 15:36:28 laurent-ubuntu-5 systemd[1]: Failed to start Docker Application Container Engine.

I try to remove --purge docker installation, and reinstall, but same error still here.

If I don’t change the /usr/lib/systemd/system/docker.service, all works fine…

Have you this same problem?

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. docker/cli#3739
  - These options have been hidden and deprecated since 17.05.
  - Deprecation notice

So, after change my /usr/lib/systemd/system/docker.service with
ExecStart=/usr/bin/dockerd --data-root /home/docker -H fd:// --containerd=/run/containerd/containerd.sock instead of
ExecStart=/usr/bin/dockerd -g /home/docker -H fd:// --containerd=/run/containerd/containerd.sock
all works fine.

I hope it can be safe for other people. :wink:

Regards

3 Likes

I had the exact same symptoms as devintcreation, but with a slightly different ExecStart value, and thus needed the same solution, just in a different location. The above answer pushed me in the right direction.

My systemctl status docker was:

Ă— docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2023-04-19 15:20:34 AEST; 24s ago
TriggeredBy: Ă— docker.socket
       Docs: https://docs.docker.com
    Process: 3846 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
   Main PID: 3846 (code=exited, status=1/FAILURE)
        CPU: 86ms

Apr 19 15:20:34 docker-01 systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Apr 19 15:20:34 docker-01 systemd[1]: Stopped Docker Application Container Engine.
Apr 19 15:20:34 docker-01 systemd[1]: docker.service: Start request repeated too quickly.
Apr 19 15:20:34 docker-01 systemd[1]: docker.service: Failed with result 'exit-code'.
Apr 19 15:20:34 docker-01 systemd[1]: Failed to start Docker Application Container Engine.

The difference being in the Process line where I had not edited the ExecStart line at all.

I had done the Docker home location change in a daemon.json file in /etc/docker/.

In my /etc/docker/daemon.json I had:

{ 
   "graph": "/docker" 
}

I believe this is the daemon.json equivalent to “-g” or “–graph” which is mentioned in the release notes.

When I changed “graph” to “data-root” docker started right up.
So, my /etc/docker/daemon.json in a working configuration is:

{ 
   "data-root": "/docker" 
}

I did not need to edit the /usr/lib/systemd/system/docker.service at all in my situation.

For reference my Server: Docker Engine - Community version is 23.0.4.

2 Likes

Thanks @sahson :+1:
it worked for me.

Wanted to say this is true for me. I had an older docker version with a modified /etc/docker/daemon.json

Glad to resolve this.