networks:
dns_net:
driver: bridge
ipam:
config:
- subnet: 172.22.0.0/16
external: false
services:
pihole:
container_name: pihole
hostname: pihole
image: pihole/pihole:latest
#shm_size: '2gb'
networks:
dns_net:
ipv4_address: 172.22.0.6
ports:
- "53:53/tcp"
- "53:53/udp"
- "8080:80/tcp"
environment:
- 'TZ=Asia/Taipei'
- 'WEBPASSWORD=mypassword'
- 'DNS1=172.22.0.7#53'
- 'DNS2=1.1.1.1'
- 'DNSSEC=true'
- 'REV_SERVER=true'
- 'REV_SERVER_DOMAIN=local'
- 'REV_SERVER_TARGET=172.22.0.1'
- 'REV_SERVER_CIDR=172.22.0.0/16'
cap_add:
- NET_ADMIN
- SYS_NICE
volumes:
- './etc-pihole/:/etc/pihole/'
- './etc-dnsmasq.d/:/etc/dnsmasq.d/'
- '/etc/resolv.conf:/etc/resolv.conf:ro'
depends_on:
unbound:
condition: service_healthy
healthcheck:
test: ["CMD", "dig", "@127.0.0.1", "-p53", "pi.hole"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
#disable: true
restart: unless-stopped
unbound:
container_name: unbound
image: mvance/unbound:latest
networks:
dns_net:
ipv4_address: 172.22.0.7
volumes:
#- ./etc-unbound:/opt/unbound/etc/unbound
- ./etc-unbound/root.hints:/opt/unbound/etc/unbound/root.hints:ro
ports:
- "5053:53/tcp"
- "5053:53/udp"
healthcheck:
disable: false
restart: unless-stopped
docker compose up -ddocker cp unbound:/opt/unbound/etc/unbound . mv unbound etc-unbound
:
unbound:
container_name: unbound
image: mvance/unbound:latest
networks:
dns_net:
ipv4_address: 172.22.0.7
volumes:
- ./etc-unbound:/opt/unbound/etc/unbound
ports:
:
:
# These private network addresses are not allowed to be returned for public
# private-address: 10.0.0.0/8
# private-address: 172.16.0.0/12
# private-address: 192.168.0.0/16
# private-address: 169.254.0.0/16
# private-address: fd00::/8
# private-address: fe80::/10
# private-address: ::ffff:0:0/96
:
docker compose up -ddocker exec pihole pihole updateGravitydocker compose restart piholedocker compose restart pihole: ports: - 53:53/udp - 53:53/tcp :
前面加上 host ip Exp. 172.16.0.245
: ports: - 172.16.0.245:53:53/udp - 172.16.0.245:53:53/tcp :
docker compose up -dpve-dns:~# docker exec pihole df -h | grep shm shm 2.0G 65M 2.0G 4% /dev/shm