Unable to access Pihole admin virtual host when using DHCP-Helper

The IP address, in this case, 172.31.0.100? It gives me:

"msg":"dial tcp 172.31.0.100:80: i/o timeout","request"

Edit: I think I figured it out. I needed to create a custom network so that Caddy and Pihole could communicate with each other. Since specifying ONLY network: backend, Caddy couldn’t see it anymore.

I changed my file to reflect the following:

  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    environment:
      DNSMASQ_LISTENING: all
      TZ: America/Boise
      VIRTUAL_HOST: pihole-4rknm.duckdns.org
      WEBPASSWORD: [redacted]
      FTLCONF_LOCAL_IPV4: 192.168.1.60
      DHCP_ACTIVE: true
      DHCP_START: 192.168.1.2
      DHCP_END: 192.168.1.254
      DHCP_ROUTER: 192.168.1.1
      WEBTHEME: default-dark
    volumes:
      - /srv/pihole/etc-pihole:/etc/pihole
      - /srv/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
    cap_add:
      - NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
    restart: unless-stopped
    depends_on:
      - dhcphelper
      - caddy
    networks:
      backend:
          ipv4_address: '172.31.0.100'
      caddy_net: {}

  dhcphelper:
    build: /srv/dhcp-helper
    restart: unless-stopped
    network_mode: "host"
    command: -s 172.31.0.100
    cap_add:
      - NET_ADMIN

networks:
  backend:
    ipam:
      config:
        - subnet: 172.31.0.0/16
  caddy_net:
    external: true

Apologies for forgetting a basic concept. Thanks for the assistance, Monviech.

2 Likes