Updating in a docker environment

Hello all,

I just tried to update my docker container for the first time and it didn't go as I expected.

It was my understanding based on the documentation that in order to get my settings to persist after a docker rebuild, I needed to create directories /dnsmasq.d/ and /pihole/ and map them to /etc/dnsmasq.d/ and /etc/pihole/. When I did this, I assumed I had done it right because pi-hole wrote a bunch of settings files into those two folders. When I went to update, I deleted my container, built a new one with the same maps, but only some of my settings persisted. For example, my blocklists got moved into the new group management page, but my DNS server settings didn't.

Does anyone have any insight into this?


I followed the instructions on the above linked documentation before this. Expected behavior was that my settings would persist, observed behavior was that only some persisted and my DNS server settings did not.

What's you docker-compose look like or the command line docker run that you are using?

I'm using docker on Synology, so its all graphical. I set my volume maps as described in the documentation, set network to use host, set serverIP, password, and web_port variables. My list persisted, but my DNS sever settings did not.

Did you set the proper Environment Variables for DNS?

No, I did not. I was under the impression, perhaps wrongly, that those settings would carry over in the persistent config directories. If that isn't the case, then I suppose mystery solved.

With synology if you have everything setup properly you do:

Download new image.

Shutdown container.

Select clear container from drop down at top of container tab.

Once it clears you turn back on the container.

If you have everything mapped properly you will have no issues.

1 Like

I have exactly the same issue (and some others). In my case with QNAP

My System:
Pihole: Pi-hole 5.2.1, FTL 5.3.2
Docker: 19.03.13

I'd Mapped:


My Env variables don't specify any DNS Server, only PGID, PUID, TZ, WebPassword

All work perfectly in my setup, but, some minors issues:

1º. "Use DNSSEC" pref is never preserved, its always cleared in every pihole boot, so I need to reconfigure again in each boot. setupVars.conf contain correctly the var: DNSSEC=true

2º. "Use DNSSEC" (per 1º), My Custom DNS Server and "Use Conditional Forwarding" (and specific settings) are not preserved between Pihole Updates. Again, setupVars.conf seem fine.

For PiHole Updates, I only remove the old container, create again the new one with the same env variables and mapping again my persistent folders. All work perfectly, my old settings, history, host, rules... except of course my 2º point.

Yes, I can add my DNS server to env, but shouldn't be necessary, all my others settings are preserved fine, except (obviously) my points 1º and 2º


Yes the writeup should be updated to set Env variables to keep some settings. Thing have changed since I wrote it for the first docker version that pihole officially released its first docker image.

The way the write up is once you clear the image it loses the DNS, DNSSEC settings. I honestly haven't bothered changing my environment variables bc I manually update my pihole package and spend the 3 seconds set them back.

At this point I will most likely wait until the next big release to redo the write-up and make sure everything works properly. There is just so many ways that you can set pi-hole up and the docker image can add a crazy layer to that creates even more ways to install.

You have to think of it that every time you clear the docker image you are technically reinstalling a virtual machine and re-installing/setting up pihole on a new machine. Variable should be set for the new install. If you really want you can use the teleporter to export the settings and reimport them after updating.

Just FYI, persistent settings are being adressed/tracked here:

1 Like

This is exactly what I needed, thanks!! very simple, no reconfiguring needed!!