Current setup
I've installed the Docker (19.03.11) on Ubuntu (20.04) based on this article: https://docs.docker.com/engine/install/ubuntu/

What would be the goal
I would like to change the data-root and tls options so I search for the config possibilities.

What options I used
- /lib/systemd/system/docker.service
- /etc/docker/daemon.json (not exits by default!)
- /etc/init/docker.conf
- /etc/default/docker
- /etc/init.d/docker
The procedure I followed
I tried all these files with the following procedures:
service docker stop
[edit the file]
systemctl daemon-reload
service docker start

What worked somehow
I can only apply the data-root option by edit the docker.service file (however) it was reset when I instelled the docker-compose, so I guess the solution is not there.

- What did I miss that cause the above solutions are not working?
- Any more option where could I pass arguments to the dockerd executable? (beside I manually start it or create my own script in the init.d folder)

1 Answer 1


From what I understand, you can only get the changes you want when you edit the file /lib/systemd/system/docker.service? Is that correct? But it gets overwritten afterwards?

You need to create a systemd drop-in file. Instructions can be found at: https://unix.stackexchange.com/a/468067/105418.

systemctl edit docker.service

That will create a custom file in /etc/systemd/system that will contain the overrides, i.e., the specific settings you wish docker to use. Thus the file in /lib/systemd/system/docker.service can be updated by others, such as docker-compose, without deleting your settings.

PS - Ubuntu 20.04 by default uses systemd and you should be using the systemctl command to start and stop docker.service.

  • The issue is with the exec start. Orinially it's ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock but I need it to be ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --data-root=/opt/docker. If I override the execstart and some other components change it, it won't work as I override with mine right?
    – Péter
    Jun 14, 2020 at 15:15

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.