Files
Pihole-Unbound/docker-compose.yml_swarm
2024-10-30 03:36:22 -04:00

69 lines
2.1 KiB
Plaintext

version: '3.9'
# I use nfs in my swarm so this is the config for nfs volumes.
# If you would rather use local volumes just remove the lines under pihole-data: and pihole-unbound: in the volumes section.
volumes:
pihole-data:
driver: local
driver_opts:
type: "nfs"
o: "addr=<nfs-server-ip>,soft,rw"
device: ":/mnt/<nfs-directory>/PiHole/pihole-data/_data/"
pihole-unbound:
driver: local
driver_opts:
type: "nfs"
o: "addr=<nfs-server-ip>,soft,rw"
device: ":/mnt/<nfs-directory>/PiHole/pihole-unbound/_data/"
services:
app:
image: <your built image>
hostname: Pihole
volumes:
- type: volume
source: pihole-data
target: /etc/pihole
# volume:
# nocopy: true
- type: volume
source: pihole-unbound
target: /etc/unbound
# volume:
# nocopy: true
- /etc/localtime:/etc/localtime:ro
- type: tmpfs
target: /dev/shm
tmpfs:
size: 2048000000
ports:
# I use host for the dns port to ensure my router can get to it directly without any docker bridge.
# This allows my known host file on my router to forward domain names for local machines to Pihole.
- target: 53
published: 53
protocol: tcp
mode: host
- target: 53
published: 53
protocol: udp
mode: host
- "443:443/tcp"
# - 53:53/tcp
# - 53:53/udp
- "80:80/tcp" #Allows use of different port to access pihole web interface when other docker containers use port 80
# - 5335:5335/tcp # Uncomment to enable unbound access on local server
# - 22/tcp # Uncomment to enable SSH
environment:
TZ: <your-timezone>
FTLCONF_webserver_api_password: '<password>'
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: any
placement:
constraints:
# Whatever constraints you need. (I have 2 vms that use high availability on proxmox so i assign this service to them to
# ensure pihole is always up.
- node.labels.HA == true