Pi-hole Docker compose cant find files

The example docker compose file in the documentation has 2 directories that need to be mapped, /etc/dsnmasq.d and /etc/pihole. I have them both mapped in the /opt folder where I store all my docker containers. I can see the contencts of t/dsnmasq.d but not the /pihole directory. I dont know if it is saving the files somwhere else but if so I can't find them.

The reason I would like to access the files is toedit the lighttpd/external.conf file to allow for iFrames so I can use docker remotely through homeassistant.

Here is my docker-compose config:

pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - "192.168.1.68:53:53/tcp"
      - "192.168.1.68:53:53/udp"
      - "80:80/tcp"
    environment:
      TZ: 'America/Chicago'
      WEBPASSWORD: Evrito1998@18
    # Volumes store your data between container upgrades
    volumes:
      - /opt/pihole:/etc/pihole
      - /opt/pihole/dnsmasq.d:/etc/dnsmasq.d
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
    restart: unless-stopped

You are mapping dnsmasq.d into a subfolder of /opt/pihole, where the parent is used by the previous mount.

Did you try to map them as distinct directories, e.g.:

    volumes:
      - /opt/pihole/etc-pihole:/etc/pihole
      - /opt/pihole/etc-dnsmasq.d:/etc/dnsmasq.d

I tried changing the directory a few times but it didnt do anything. This time i just tried killing the docker container and re reunning the docker compose command and now the files appeared. Before i was just restarting in portainer which normnally works but i geuss not in this instance

Restarting a container will just reuse what you had when the container was created.

Note on Portainer:

  • clicking on the "Recreate" button on Portainer interface, will use the same values you entered on the first time, but will reset some values.
  • using the "Duplicate/Edit" button on Portainer interface, will load the same values you entered on the first time (plus some default values set by the image).
    There is no real way to edit a container after you started it.
    If you use this button to "edit" a previous container, you will need to check every setting, to avoid reusing unneeded values.

The best approach is always Remove the container and start a new one.