-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1204 from willman42/dev
init commit of Pi-hole behind Caddy example
- Loading branch information
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pihole-dev.lab { | ||
tls internal | ||
redir / /admin | ||
reverse_proxy pihole:8081 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
version: "3" | ||
|
||
services: | ||
|
||
# Caddy example derived from Caddy's own example at https://hub.docker.com/_/caddy | ||
caddy: | ||
container_name: caddy | ||
image: caddy:latest | ||
networks: | ||
- caddy-net # Network exclusively for Caddy-proxied containers | ||
restart: unless-stopped | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
- "443:443/udp" # QUIC protocol support: https://www.chromium.org/quic/ | ||
volumes: | ||
- ./Caddyfile:/etc/caddy/Caddyfile # config file on host in same directory as docker-compose.yml for easy editing. | ||
#- $PWD/site:/srv # Only use if you are serving a website behind caddy | ||
- caddy_data:/data # Use docker volumes here bc no need to access these files from host | ||
- caddy_config:/config # Use docker volumes here bc no need to access these files from host | ||
|
||
|
||
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/ | ||
pihole: | ||
depends_on: | ||
- caddy | ||
container_name: pihole | ||
#dns: # Optional. Specify desired upstream DNS servers here. | ||
# - 127.0.0.1 | ||
# - 9.9.9.9 | ||
# - 149.112.112.112 | ||
image: pihole/pihole:latest | ||
networks: | ||
- caddy-net # Need to plug into caddy net to access proxy | ||
ports: | ||
- "8081/tcp" # Pi-hole web admin interface, proxied through Caddy (configure port in Caddyfile) | ||
# Following are NOT proxied through Caddy, bound to host net instead: | ||
- "53:53/udp" | ||
- "53:53/tcp" | ||
- "853:853/tcp" # DNS-over-TLS | ||
#- "67:67/udp" # DHCP, if desired. If not bound to host net you need an mDNS proxy service configured somewhere on host net. | ||
# ref: https://docs.pi-hole.net/docker/DHCP/ | ||
environment: | ||
TZ: 'America/New_York' # Supported TZ database names: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#Time_Zone_abbreviations | ||
WEBPASSWORD: 'password' # Only used on first boot, change with pihole cli then comment out here. | ||
volumes: | ||
- './etc-pihole:/etc/pihole' | ||
- './etc-dnsmasq.d:/etc/dnsmasq.d' | ||
- './etc-lighttpd/external.conf:/etc/lighttpd/external.conf' # Recommend leave as bind mount for easier editing. | ||
# ref for why you may need to change this file: https://docs.pi-hole.net/guides/webserver/caddy/#modifying-lighttpd-configuration | ||
#cap_add: # Uncomment if using Pi-hole as DHCP server | ||
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities | ||
#- NET_ADMIN # ONLY required if you are using Pi-hole as your DHCP server, else remove for better security | ||
restart: unless-stopped | ||
|
||
# ref: https://hub.docker.com/_/caddy | ||
networks: | ||
caddy-net: | ||
driver: bridge | ||
name: caddy-net | ||
|
||
# ref: https://hub.docker.com/_/caddy | ||
volumes: | ||
caddy_data: | ||
external: true # May need to create volume with 'docker volume create caddy_data' | ||
caddy_config: |