How can I give Docker containers access to a dnsmasq local DNS resolver on the host?
<p>There are lots of ways in which Docker containers can get confused about DNS settings (just search SO or the wider internet for "Docker DNS" to see what I mean), and one of the common workarounds suggested is to:</p>

<ol>
<li>Set up dnsmasq as a local DNS resolver on the host system</li>
<li>Bind it to the <code>docker0</code> network interface</li>
<li>Configure Docker to use the <code>docker0</code> IP address for DNS resolution</li>
</ol>

<p>However, attempting to apply this workaround naively on many modern Linux systems will send you down a rabbithole of Linux networking and process management complexity, as systemd assures you that <code>dnsmasq</code> isn't running, but <code>netstat</code> tells you that it is, and actually attempting to start <code>dnsmasq</code> fails with the complaint that port 53 is already in use.</p>

<p>So, how do you reliably give your containers access to a local resolver running on the host, even if the system already has one running by default?</p>