Hi everybody,
I'm pretty new to this whole networking environment, like docker, pihole and stuff.
Every service I run is on docker on a rpi, including pihole and caddy for reverse proxy. The issue I'm facing is: after setting up everything on docker compose and caddy, I can't access pihole using my domain name. Basically I get redirected to the admin page, then it returns 502 code for some reason.
Though, It is accessible if I use the local ip of the rpi and the port I've assigned to pihole. And I know my domain/DNS setup works because I can access other services using the domain name.
Here's the docker compose file:
version: '3'
services:
caddy:
container_name: caddy
image: caddy:2
restart: always
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- /home/docker/caddy/Caddyfile:/etc/caddy/Caddyfile:ro
- /home/docker/caddy/config:/config
- /home/docker/caddy/data:/data
pihole:
container_name: pihole
image: pihole/pihole:latest
restart: unless-stopped
network_mode: host
volumes:
- /home/docker/pihole:/etc/pihole
- /home/docker/pihole/dnsmasq.d:/etc/dnsmasq.d
cap_add:
- NET_ADMIN
environment:
- TZ=Europe/Stockholm
- PIHOLE_DNS_=8.8.8.8;8.8.4.4
- FTLCONF_LOCAL_IPV4=192.168.0.143 # local ip of the raspberrypi
- DNSMASQ_LISTENING=all
- WEB_PORT=8125
#...other services
and the caddy file basically contains this for pihole:
pihole.mydomain.com {
reverse_proxy pihole:8125
}
#...other services
I've also tried removing the network_mode: host
and exposing ports instead but it still has the same issue. For the record, I'd like to use DHCP so I prefer this to stay.
Has anybody have any idea about this? Thanks in advance!