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.
Questions:
– 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)
Best Answer
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.
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.