Hi,
I have a docker compose + dockge installed on a Debian LXC container running on FreeNAS. I’m running several home services, such as tt-rss and nextcloud, with caddy providing reverse proxy support. In order to resolve the reverse proxied URLs inside the LAN, I also installed Pi-hole as another compose.yml container, configured it to resolve those URLS to the local IP, and set my router to hand out the docker-host IP (with port 53 forwarded to pihole) as the DNS server. This works great! Except that the docker-host IP gets flowed from TrueNAS into the docker-host’s resolv.conf, and then into docker where it breaks all DNS resolution for containers. I suspect this is something akin to NAT loopback, where the connection isn’t allowed to go down to the docker host’s IP and back up to the container.
To finish the nextcloud-aio install, I do need the nextcloud URL to resolve locally from within the nextcloud containers. So if I configure the pihole IP on its docker-network to be static, add the pihole network to the other compose file, and manually add “dns: pi.hole.ip.addr” then that container will be able to resolve DNS again! But nextcloud-aio creates sub-containers which I don’t see a way to do this for. Those sub containers (such as nextcloud-aio-nextcloud) are unable to resolve DNS queries.
I believe my lack of knowledge around docker networks is making this way harder than it needs to be. If you know of the right way to set this up in docker compose please let me know!
caddy compose:
services:
caddy:
image: lucaslorentz/caddy-docker-proxy:2.9.1-alpine
ports:
- 80:80
- 443:443
environment:
- CADDY_INGRESS_NETWORKS=caddy
- CADDY_DOCKER_CADDYFILE_PATH=/etc/caddy/Caddyfile
networks:
caddy:
priority: 100
nextcloud-aio:
priority: 10
dns: 172.28.0.4
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- caddy_data:/data
- /mnt/data/caddy/caddyfile/Caddyfile:/etc/caddy/Caddyfile
restart: unless-stopped
networks:
caddy:
external: true
nextcloud-aio:
external: true
volumes:
caddy_data: {}
pihole compose:
# 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:
- 53:53/tcp
- 53:53/udp
- 8060:80/tcp
environment:
TZ: America/Chicago
WEBPASSWORD: mypassword
# Volumes store your data between container upgrades
volumes:
- /mnt/data/pi-hole/etc:/etc/pihole
- /mnt/data/pi-hole/dnsmasq-d:/etc/dnsmasq.d
networks:
caddy:
ipv4_address: 172.28.0.4
default: null
labels:
caddy: domain.name
caddy.reverse_proxy: "{{upstreams 80}}"
caddy.redir: / /admin/
restart: unless-stopped
networks:
caddy:
external: true
nextcloud compose:
services:
nextcloud-aio-mastercontainer:
image: nextcloud/all-in-one:latest
init: true
restart: unless-stopped
container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed as otherwise AIO will not work correctly
volumes:
- nextcloud_aio_mastercontainer:/mnt/docker-aio-config # This line is not allowed to be changed as otherwise the built-in backup solution will not work
- /var/run/docker.sock:/var/run/docker.sock:ro # May be changed on macOS, Windows or docker rootless. See the applicable documentation. If adjusting, don't forget to also set 'WATCHTOWER_DOCKER_SOCKET_PATH'!
#network_mode: bridge # add to the same network as docker run would do
dns: 172.28.0.4
# The three lines below were to freeze the container while running to debug it.
#command: -F anything
#entrypoint: /usr/bin/tail
#tty: true
networks:
- caddy
- nextcloud-aio
ports:
#- 8070:80 # Can be removed when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
- 8088:8080
#- 8443:8443 # Can be removed when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
labels:
caddy: cloud.domain.name
caddy.reverse_proxy: nextcloud-aio-apache:11000
#caddy.reverse_proxy: nextcloud-aio-domaincheck:11000 # Used for initial setup
environment:
APACHE_PORT: 11000 # Is needed when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
APACHE_IP_BINDING: 0.0.0.0 # Should be set when running behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else) that is running on the same host. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
NEXTCLOUD_DATADIR: /mnt/data/nextcloud/data # Allows to set the host directory for Nextcloud's datadir. ⚠️⚠️⚠️ Warning: do not set or adjust this value after the initial Nextcloud installation is done! See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir
NEXTCLOUD_UPLOAD_LIMIT: 10G # Can be adjusted if you need more. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-upload-limit-for-nextcloud
volumes:
# If you want to store the data on a different drive, see https://github.com/nextcloud/all-in-one#how-to-store-the-filesinstallation-on-a-separate-drive
nextcloud_aio_mastercontainer:
name: nextcloud_aio_mastercontainer # This line is not allowed to be changed as otherwise the built-in backup solution will not work
networks:
caddy:
external: true
nextcloud-aio:
external: true
FreeNAS 24.04
Docker version 27.3.1, build ce12230
Docker Compose version v2.29.7