-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create an unbound docker-compose example #315
Comments
I was curious about this as well. So one thing I was unsure on... what listens on port 53? You have Pi-Hole on 53, right? And then it doesn't matter with Unbound is on, you just set that same Port in the config, correct? |
Exactly, you start a unbound container e.g.: -p 5553:53 then set UnboundContainerIP#5553 in pihole settings. |
When you say |
Depends if you use docker host networking or default docker bridge networking. Having bridged docker containers connect to each other on docker's internal network is the common approach. Typically that'd be done by using the hostname alias provided by Docker since it abstracts Docker's DHCP providing a random IP address. Since Pi-hole needs IPs for DNS and Docker DHCP adds randomness I'm thinking the example will need to have a static Docker IP address applied to the unbound container's config. |
Well, the key is the Is that correct? |
OK, I get what you're saying now, that could be a valid alternative to using the static IP on unbound and having Pi-hole use said static ip. I was just thinking that going out of the docker LAN and back in through the port forward is an unnecessary hop and exposes a service that doesn't have to be exposed. Staying within the Docker internal network with a static IP on unbound is a little cleaner IMO. Either approach should work and the extra I'm not 100% sure how docker network routing works with their current implementation, the bottom of this page discusses it but I find it confusing.
That bit does makes me think the new userland-proxy (on by default) is not as efficient for container connections that go out to a docker host port forward and then back into another container. |
@CWSpear correct. |
So this should work in theory (NOT TESTED): (Note, in these examples, replace version: '3.7'
services:
pihole:
image: pihole/pihole
restart: unless-stopped
links:
- ubound
ports:
- 53:53/tcp
- 53:53/udp
- 67:67/udp
volumes:
- <LOCAL_PIHOLE_VOLUME_PATH>:/etc/pihole/
- /etc/dnsmasq.d/:/etc/dnsmasq.d/
# this isn't strictly necessary, but Ubuntu 18.04 has a symlink to here and I didn't want to mess
- /etc/dnsmasq.d-available/:/etc/dnsmasq.d-available/
cap_add:
- NET_ADMIN
dns: 127.0.0.1
environment:
TZ: America/Los_Angeles
ServerIP: <DOCKER_HOST_IP>
PROXY_LOCATION: pihole
DNS1: unbound#53
DNS2: no
unbound:
image: mvance/unbound
restart: unless-stopped The If someone wants to use that as a starting point... If version: '3.7'
services:
pihole:
image: pihole/pihole
restart: unless-stopped
links:
- ubound
ports:
- 53:53/tcp
- 53:53/udp
- 67:67/udp
volumes:
- <LOCAL_PIHOLE_VOLUME_PATH>:/etc/pihole/
- /etc/dnsmasq.d/:/etc/dnsmasq.d/
# this isn't strictly necessary, but Ubuntu 18.04 has a symlink to here and I didn't want to mess
- /etc/dnsmasq.d-available/:/etc/dnsmasq.d-available/
cap_add:
- NET_ADMIN
dns: 127.0.0.1
environment:
TZ: America/Los_Angeles
ServerIP: <DOCKER_HOST_IP>
PROXY_LOCATION: pihole
DNS1: <DOCKER_HOST_IP>#9753
DNS2: no
unbound:
image: mvance/unbound
restart: unless-stopped
ports:
- 9753:53/tcp
- 9753:53/udp Anyway... something like that... |
Hello, |
With
Without it or with |
@CWSpear did you by any chance test this? Whatever I do pihole keeps saying "dns resolution unavilable" though I can resolve via exposed port 5353 in my case from the local lan but not from the overlay with:
|
I made small adjustmend from the example CWSpear Link to the Post and it works for me. Service pihole:
service unbound:
|
I've used what you've done, however, I'm not sure it's actually working. If I remove the second DNS server and solely rely on Unbound (i.e. 127.0.0.01:5353) and then do dig commands to random URLs, it won't resolve which tells me that pi-hole is not linking to unbound. |
@eflemingtra 127.0.0.01:5353 please check the IP, it could be DNS1 127.0.0.1:5353 I check my pihole dns request, and get follow response. The IP 127.0.0.11 is right (as far as I know) this is the docker proxy local IP)
|
Okay, so it seems to be an issue with Ubuntu. Unbound appears to be working, but unless I specify Ubuntu to use 127.0.0.1@5354, it won't work. So, for example, dig pi-hole.net @127.0.0.1 -p 5354 gives me a positive response. If I just do dig pi-hole.net, nothing is resolved. Similarly, if I input any command that requires an internet connection (say apt-get update), it won't work. Interestingly, all my other containers that require net access are working fine. I'm guessing I need to tell Ubuntu to use 127.0.0.1#5354? |
I put DNS2="no" and it seems to work and leave it empty. (Note the double quotes) |
I created a single docker image containing both pihole and unbound. Unbound is exposed as port 5053 and pihole uses port 53, plus 80 and 443. (These aren't in the docker-compose file since I'm linking to an external network but they can be added.) It's my first shot at docker so I'm sure it can be improved but it does seem to work for me. Code: https://github.com/mcarson75/unbound-pihole |
This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days. |
I'm trying to run both Pihole and Unbound using a Docker compose, but I'm facing an issue I cannot fix. Once the containers are up, DNS queries are forwarded from Pihole to Unbound on the Pihole log. Still, the host where I'm running the containers lost its ability to make queries, e.g., If I do dig pi-hole.net on the host console I can't resolve the IP address.
I used the same configuration some people here have used without success. Since I can't resolve DNS on the Pihole container, I keep getting DNS resolution errors on the Pihole log, and the Gravity tables are not updated.
My docker-compose.yaml looks like the following:
I noticed that the DNS resolution in the container host is being sent to 127.0.0.11, instead of the DNS server in /etc/resolv.conf. I'm using docker on a Ubuntu 23.04. |
https://github.com/Blu-Eagle/pihole-ubound-tls-portainer.git |
Since this took me a while to figure out, I'll share my setup. I do NOT use If you need Pi-hole's DHCP, you probably need to keep using This runs Pi-hole with port 53 exposed. It runs Unbound without any ports exposed, there is no need to do a funny mapping like Code is provided as is without any warranty. PS: I don't know if the PPS: with the services:
pihole:
image: pihole/pihole:latest
networks:
- pibound
ports:
- 53:53/tcp
- 53:53/udp
environment:
- PIHOLE_DNS_=192.168.100.100
unbound:
image: mvance/unbound:latest
networks:
pibound:
ipv4_address: 192.168.100.100
networks:
pibound:
ipam:
config:
- subnet: 192.168.100.0/24
gateway: 192.168.100.1 |
This is covered by other repositories |
Started based off conversation in #311
In the same style of the existing docker-compose example files, let's create a multi-service docker-compose yaml file with unbound + pihole using https://docs.pi-hole.net/guides/unbound/ as the basis.
First iteration may only support x86 as I don't see much for ARM unbound images.. See: unbound containers available on docker hub.
The text was updated successfully, but these errors were encountered: