Pi-Hole (docker) overwrites /etc/dnsmasq.d/01-pihole.conf

Hello, I have a problem with my pihole which I can't get solved but is probably relatively easy to solve.

My Pihole container does not answer DNS requests, it gives a communication error and the requests are not displayed on the dashboard. However, as soon as I go into the settings, do not change, and just press save, the Pihole works fine until the next reboot. The problem is probably in the /etc/dnsmasq.d/01-pihole.conf file that is overwritten on reboot. Here is the file after a reboot:

addn-hosts=/etc/pihole/local.list
addn-hosts=/etc/pihole/custom.list

domain-needed

localise-queries

bogus-priv

no-resolv

log-queries
log-facility=/var/log/pihole/pihole.log

log-async
interface=
cache-size=10000

And here the file after save:

addn-hosts=/etc/pihole/local.list
addn-hosts=/etc/pihole/custom.list


localise-queries


no-resolv

log-queries
log-facility=/var/log/pihole/pihole.log

log-async
cache-size=10000
server=10.200.1.11
domain-needed
expand-hosts
bogus-priv
dnssec
trust-anchor=.,20326,8,2,E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D

except-interface=nonexisting

And here is my docker-compose.yaml:

version: "3"
services:

#Pi-Hole
  pihole_server:
    container_name: pihole_server
    image: pihole/pihole:latest
    hostname: pihole01
    environment:
      TZ: 'Europe/Berlin'
      WEBPASSWORD: 'XDyf9BkDTcrq8aLZ'
    volumes:
      - '/root/docker/dns/pihole:/etc/pihole'
      - '/root/docker/dns/dnsmasq:/etc/dnsmasq.d/'
      - '/root/docker/dns/cron_pihole:/etc/cron.d/pihole'
      - '/root/docker/dns/hosts:/etc/hosts'
    restart: unless-stopped
    networks:
      server:
        ipv4_address: 10.200.1.10

#Unbound
  unbound:
    container_name: unbound_server
    image: alpinelinux/unbound:latest
    volumes:
      - '/root/docker/dns/unbound:/etc/unbound'
    restart: unless-stopped
    networks:
      server:
        ipv4_address: 10.200.1.11

networks:
  server:
    name: server
    external: true

The problem is I have no idea why the pihole behaves like this. Even if the file is recreated, which I understand, why are the settings not applied instead of loading the default file?

I hope someone can help me :slight_smile:

The header of the file contains the following:

###############################################################################
#      FILE AUTOMATICALLY POPULATED BY PI-HOLE INSTALL/UPDATE PROCEDURE.      #
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
#                                                                             #
#        IF YOU WISH TO CHANGE THE UPSTREAM SERVERS, CHANGE THEM IN:          #
#                      /etc/pihole/setupVars.conf                             #
#                                                                             #
#        ANY OTHER CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE           #
#                    WITHIN /etc/dnsmasq.d/yourname.conf                      #
###############################################################################

Thanks for your answer! Yes I understand that, but I do not know how to solve the problem. If I put the desired content in a new file it has no effect.

This looks like a file system/permission issue:

How did you go about creating /root/docker/dns/dnsmasq/?

Under which user is docker running?

I'm not sure if docker is able to access/modify files in /root directory. Try again using a different place to store your volumes.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.