This is a follow up to Start: Support hostnames and domains in PIHOLE_DNS_ by networkException · Pull Request #816 · pi-hole/docker-pi-hole · GitHub #docker
Currently the docker configuration does not allow for a hostname or domain in the pihole dns configuration. Technically DNS servers are never domains but in some cases the ip of a domain might want to be used as the DNS server. In particular a docker-compose stack would benefit from this feature:
services:
pihole:
image: pihole/pihole
hostname: pihole
depends_on:
- dnscrypt
ports:
- 53:53/udp
environment:
PIHOLE_DNS_: dnscrypt
dnscrypt:
image: #...
By resolving the ip of "dnscrypt" on startup, pihole could now use the dnscrypt container as a DNS server.
DL6ER
October 24, 2021, 7:44am
#2
@PromoFaux Could you check this out?
system
closed
April 22, 2022, 7:45am
#3
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
There is an upstream PR to dnsmasq
which would implement this feature
pi-hole:master
← pi-hole:new/resolve_server
opened 03:22PM - 03 Feb 22 UTC
In docker swarm and compose configurations, other containers are only reachable … via hostnames. It is not possible to assign IP addresses beforehand. Hence, the upstream server IP is not known at `dnsmasq` start when the upstream is part of the deployed configuration, e.g., a local `cloudflared` or `unbound` container.
So far, getting `dnsmasq` to run in such a case requires hacks that somehow try to determine the IP address before starting dnsmasq. An example for such a hack: https://github.com/tschaffter/docker-dnsmasq/blob/54b5d5d551746b6f1708fbf4a705e2de66c2eaee/docker-entrypoint.sh#L14-L23
This patch implements name resolution functionality for `server=...` by querying the system resolver for a hostname. It is only used when a user supplied something that is not a valid IP address (`dnsmasq` currently fails hard in this case) and can be omitted by a compile time flag (I think it's worthwhile to have it). I know my proposal does sound somewhat strange (resolving a DNS server name) but this is something that is somewhat frequently needed and currently only possible through external hacks.
1 Like