Unable to access Pi-hole using pi.hole

Context:

I am running Pi-hole in a Docker container, within an LXC on my Proxmox server. I have assigned a static IPv4 address to the LXC of 172.29.83.104.

I am using this arrangement, as I find it easier and more convenient to spin up and manage a Docker container and it’s configuration, rather than it is with an entire LXC.

I am unable to access the admin panel using pi.hole/admin. I am still able to access Pi-hole using it’s IP address, and by using the proxy host I set for it in Nginx.

This is the docker-compose.yaml for my Pi-hole container:

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      # DNS Ports
      - "53:53/tcp"
      - "53:53/udp"
      # Default HTTP Port
      - "80:80/tcp"
      # Default HTTPs Port. FTL will generate a self-signed certificate
      - "443:443/tcp"
      # Uncomment the line below if you are using Pi-hole as your DHCP server
      #- "67:67/udp"
      # Uncomment the line below if you are using Pi-hole as your NTP server
      #- "123:123/udp"
    environment:
      # Set the appropriate timezone for your location (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), e.g:
      TZ: 'Europe/London'
      # Set a password to access the web interface. Not setting one will result in a random password being assigned
      FTLCONF_webserver_api_password: 'REDACTED'
      # If using Docker's default `bridge` network setting the dns listening mode should be set to 'all'
      FTLCONF_dns_listeningMode: 'all'
    # Volumes store your data between container upgrades
    volumes:
      # For persisting Pi-hole's databases and common configuration file
      - './etc-pihole:/etc/pihole'
      # Uncomment the below if you have custom dnsmasq config files that you want to persist. Not needed for most starting fresh with Pi-hole v6. If you're upgrading from v5 you and have used this directory before, you should keep it enabled for the first v6 container start to allow for a complete migration. It can be removed afterwards. Needs environment variable FTLCONF_misc_etc_dnsmasq_d: 'true'
      #- './etc-dnsmasq.d:/etc/dnsmasq.d'
    cap_add:
      # See https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
      # Optional, if Pi-hole should get some more processing time
      - SYS_NICE
    restart: always

Expected Behaviour:

I should be able to access the admin panel using pi.hole/admin.

Actual Behaviour:

Going to pi.hole/admin returns a ERR_CONNECTION_TIMED_OUT error.

Debug Token:

https://tricorder.pi-hole.net/qyuutIPk/

Can you access the web interface via IP?

Also, you changed webserver.domain from pi.hole to custom domain.
Can you access the web interface using this domain?

Yes, I can access it using that IP. I had set the webserver.domain to the custom domain a while ago. I just tried replacing it with the default pi.hole and restarted the container, but this didn’t fix the issue. I get the same issue when going to pi.hole or pi.hole/admin.

When I try to ping pi.hole from my PC (which uses my Pi-hole as DNS), I get:

PS C:\> ping pi.hole

Pinging pi.hole [172.18.0.2] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 172.18.0.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

172.18.0.2 is the IP address of the Pi-hole Docker container itself, and not the LXC. As this is different to my LAN subnet, while it can resolve the domain as Pi-hole knows it, it can’t actually reach that IP.

Your container is answering with the wrong IP, because that's the only IP visible from within the container.

You need to tell Pi-hole which IP should be used adding these environment vars to the compose file:

      FTLCONF_dns_reply_host_IPv4: '172.29.83.104'
      FTLCONF_dns_reply_host_force4: true

That fixed it! Thanks for your help!