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 ?