Systemd dockerd.service: open /etc/docker/daemon.json: no such file or directory?

Hi all.

Puzzling behaviour:

If I run “systemctl start docker.service”
dockerd complains with “open /etc/docker/daemon.json: no such file or directory”
and does nos start.
But if I run the exact same command from docker.service ExecStart
on the command line it works with no problems.

I have no idea why
So I created a shell script to start it from the exact same command like
on ExecStart with now ExecStart running the script and it works

I initially changed for Type=forking but is the same.

Any clue on this?

My docker.service

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket containerd.service time-set.target
Wants=network-online.target containerd.service
Requires=docker.socket

[Service]
Type=notify
ExecStart=/usr/bin/dockerd -H unix:///xvar/Docker/tmp/dockerd.sock --pidfile="/xvar/Docker/tmp/dockerd.pid" --config-file="/etc/docker/daemon.json"
ExecReload=/bin/kill -s HUP $MAINPID
ExecStopPost=/etc/systemd/system/PMG/DockerBridge-2.sh stop
TimeoutStartSec=0
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
Delegate=yes
KillMode=process
OOMScoreAdjust=-500

[Install]
WantedBy=multi-user.target

What is the exact same command? If you realyl run the same command including the --config-file option, you would need to get the same error. That option os not required and docker will use the same path by default. If you define the path, you will get the error message when the files doesn’t exist.

I edited your post. Please, check our formatting guide for using code blocks: How to format your forum posts

My description was clear.

If I run on the command line

/usr/bin/dockerd -H unix:///xvar/Docker/tmp/dockerd.sock --pidfile=“/xvar/Docker/tmp/dockerd.pid” --config-file=“/etc/docker/daemon.json”

it works, no complain about "open /etc/docker/daemon.json: no such file or directory”
Also
dockerd --validate returns OK

But if I run the same exact command via ExecStart with systemd as systemctl start docker.service it
complains “open /etc/docker/daemon.json: no such file or directory” and does not start

Wrong permissions set for the file or parent folder?

And I have to repeat myself