How to make dnsmasq work on Alpine (docker)?
2
votes
1
answer
3960
views
On Debian-based Linux, dnsmasq works by replacing the
nameservers
in /etc/resolv.conf
with 127.0.0.1
(referring to "Linux for Wireless Engineers: How to Do DNS Caching with dnsmasq ").
But I find that on Alpine (and Alpine based docker) it does not work that way. When dnsmasq starts, /etc/resolv.conf
remains the same. So if I just start dnsmasq it makes no difference in term of dns resolving. I write a script to start dnsmasq and it feels awkward.
cp /etc/resolv.conf /etc/resolv.dnsmasq
sed -i 's/^nameserver.*/nameserver 127.0.0.1/' /etc/resolv.conf
dnsmasq -r /etc/resolv.dnsmasq
So is there a better ("proper") way make dnsmasq work on Alpine ?
Asked by Qiulang 邱朗
(261 rep)
Nov 19, 2021, 06:13 AM
Last activity: Sep 11, 2024, 07:15 PM
Last activity: Sep 11, 2024, 07:15 PM