Skip to content

Instantly share code, notes, and snippets.

@SeanChristopherConway
Last active June 15, 2022 00:30
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save SeanChristopherConway/db780ac550198e1e52231f9a62046af0 to your computer and use it in GitHub Desktop.
Save SeanChristopherConway/db780ac550198e1e52231f9a62046af0 to your computer and use it in GitHub Desktop.
Docker Pihole with unbound for authoritative, validating, recursive caching DNS
version: "3.7"
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
dns: 127.0.0.1
restart: unless-stopped
links:
- unbound
ports:
- 53:53/tcp
- 53:53/udp
- 67:67/udp
- 80:80/tcp
- 443:443/tcp
environment:
ServerIP: {server_ip, eg. 192.x.x.x}
DNS1: 10.0.0.2#53
DNS2: "no"
IPv6: "no"
TZ: America/Vancouver
PROXY_LOCATION: pihole
cap_add:
- NET_ADMIN
volumes:
- ${DOCKER_CONFIGS}/docker_pihole/pihole/:/etc/pihole/ #use a .env file to set, eg. DOCKER_CONFIGS=/whatever_folder_you_want
- ${DOCKER_CONFIGS}/docker_pihole/pihole/dnsmasq.d/:/etc/dnsmasq.d/
networks:
pihole_net:
ipv4_address: 10.0.0.3
unbound:
container_name: unbound
image: klutchell/unbound:armv7hf
restart: unless-stopped
networks:
pihole_net:
ipv4_address: 10.0.0.2
networks:
pihole_net:
driver: bridge
ipam:
config:
- subnet: 10.0.0.0/29
@Kampe
Copy link

Kampe commented Jul 1, 2019

Does this work for you? Pihole can't communicate with my Unbound container due to I assume port mapping issues, I've tried using different sets of ports and utilizing them in the DNS1 Entry, but no luck.

@twixt01
Copy link

twixt01 commented Apr 15, 2020

Does this work for you? Pihole can't communicate with my Unbound container due to I assume port mapping issues, I've tried using different sets of ports and utilizing them in the DNS1 Entry, but no luck.

https://github.com/klutchell/unbound I believe you have to set 5053 in pihole DNS server setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment