Docker Community Forums

Share and learn in the Docker community.

Persist dockerd options after docker-ce update in RHEL/CentOS

Hi,

I set some options for dockerd as explained here.

Because I’m on RHEL, I used the option of changing the ExecStart line in the docker.service file.
The thing is that this file is overwritten whenever the docker-ce package is updated. So after an update the dockerd options I had set are gone.

I tried adding the options the Ubuntu way:

– changing DOCKER_OPTS in /etc/default/docker
OR
– editing /etc/docker/daemon.json

but it didn’t work.

So my question is: is there a way of adding dockerd options in RHEL/CentOS that would persist after an update of the docker-ce package?

Thanks

what is not working? i have edited “/etc/docker/daemon.json” myself on CentOS, and it works fine

Thank you @terpz, you are right. It does work.

When I tried the first time, I added the data-root option to daemon.json, and then I only ran ps ax | grep dockerd to check if it worked. I was expecting to see the --data-root option in the command but it wasn’t there, so I assumed it wasn’t working.

But I can see that it is working by checking the data root with docker info.

I do think the link I posted above is misleading as it suggests that editing the docker service file is the only way to set dockerd options in RHEL/CentOS…