How can I keep my Docker data root settings persistent after updates?

0
0
Asked By CuriousCat123 On

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

Answered By TechieGuru42 On

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.

User1234 -

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.

AnotherUser567 -

While this is a solid approach, you can also set this using the `daemon.json` file for a more straightforward setup!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.