I'm having an issue with my Docker setup where I always add `--data-root /home/docker/` to the ExecStart line in my `/lib/systemd/system/docker.service` file. However, whenever I update Docker, this modification gets wiped out, and I have to keep re-adding it. Is there a way to make sure this setting stays in place after updates? Thanks for your help!
1 Answer
You really shouldn't be editing `docker.service` directly in the `/lib/systemd/system/` directory. Instead, you can use the systemd override feature. Just run `systemctl edit docker.service`, and it'll create an override config for you. You only need to specify the changes you want, and the rest will remain as is. Check out the docs on override configurations for more details.
While this is a solid approach, you can also set this using the `daemon.json` file for a more straightforward setup!
I tried editing, but I get a message saying the temporary file is empty. Any idea why? I reopen the file, and it doesn't change.