Celeb Glow
updates | March 26, 2026

systemd wont use dockerd configuration file

I have to use systemctl daemon-reload and systemctl restart docker after every reboot, then the docker service will use daemon.json file to override default settings.

Ubuntu server 18.04, docker-ce 18.09.7

Is there a way to make this persistent ?

user@host:~$ cat /etc/docker/daemon.json
{ "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2"
}
4

2 Answers

Follow these steps.

  1. Go to /etc/init.d
  2. Add a file( say example ) and place the script you want to execute in that.
  3. chmod +x /etc/init.d/example. (permissions)
  4. Add # chkconfig: 345 99 10 inside your script
  5. Save it 6 Start the service with — service example start.

This should work as system service/ startup service .

Go into your example, vi /etc/init.d/example then add -

systemctl daemon-reload
systemctl restart docker

If your commands do the work of over-writing , this will work.

Let me know if you face any challenge as distors do matter.

The default config file used during start up is actually this one: /var/snap/docker/current/config/daemon.json

You can update this file instead.

# Remove existing /etc/docker/daemon.json fisrt.
ln /var/snap/docker/current/config/daemon.json /etc/docker/daemon.json
cat > /etc/docker/daemon.json <<EOF
{ "exec-opts": ["native.cgroupdriver=systemd"], "log-driver": "json-file", "log-opts": { "max-size": "100m" }, "storage-driver": "overlay2"
}
EOF

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy