Two PiHole servers and extra hosts

I have two pihole servers running, and each of them have extra host entries. My “main” server is running in a container on my workhorse machine. My “backup” server is running on a RPI like machine.

Occasionally the main server goes down when I’m fiddling. My router points to main as the primary and the backup as the secondary dns.

When both are running, I can only see the extra hosts on the main pihole. If main goes down, I can see the hosts on the backup. What can I do (other than copying the host entries) so that I can always see the extra hosts on both servers?

Please elaborate, and provide examples.

Let’s say my “main” server is running several docker containers, and one of them is a web server who has an internal address of For all internal network requests I’m going to want that address returned for For external requests, will get my wan IP address and use reverse proxy to get the web server.

The backup server has no idea about even exists. But if it returns the wan ip, it won’t work inside the network.

I guess what I’m looking for is to somehow have the backup server provide the same results as the main server, especially if the main server goes down.

The term we need to understand better is 'host entries'.
Is that referring to /etc/hosts or some other file, and if the latter, does it constitute a list of hosts to be blocked, or a whitelist, or just host-to-ip address associations, or is it something you've configured Pi-hole for to use or something you've entered somewhere via Pi-hole's UI?

I’m running PiHole in a Docker container. This is part of my docker-compose.yaml

version: "3.3"

    container_name: pihole
    domainname: docker
    hostname: ${PIHOLE_HOST}
    image: pihole/pihole:latest
      - 53:53/tcp
      - 53:53/udp
      - 80:80
      - 443:443
    restart: unless-stopped
      - NET_ADMIN
      - ${USERDIR}/${REPODIR}/pihole/pihole:/etc/pihole
      - ${USERDIR}/${REPODIR}/pihole/dnsmasq.d:/etc/dnsmasq.d
      - ${USERDIR}/${REPODIR}/pihole/scripts:/etc/scripts
      - VIRTUAL_PORT=80
      - TZ=${TZ}
      - DNS1=
      - DNS2=
      - vpn.${DOMAINNAME}:${SERVER_IP}
      - pihole.${DOMAINNAME}:${SERVER_IP}
      - dmz:

As you can see, I’m using the extra_hosts directive to add some dns entries to this pihole container.

As this is a Docker directive, your issue would be specific for Docker rather than Pi-hole.

I'd guess that as long as you start your containers with identical extra_hosts directives, your Docker containers should behave the same.