Ubuntu 18 and Docker DNS

So I’ve reinstalled linux on my laptop and am running Ubuntu 18.04.1 LTS - Kali was OK, but there was a lot of cruft and one of the more “desktop” distributions seemed more inviting. No, not Arch.

I ran into an issue today however, with DNS resolution failing in my docker containers because of how systemd messes with /etc/resolv.conf. It sets a 127.0.0.53 address, which is systemd-resolved, screwing with docker’s init scripts.

For most people that’s not a problem, but when you regularly connect to networks that block google’s 8.8.8.8 and 8.8.4.4 (which docker reverts to, ugh). That’s a bit of a problem.

The fix, based on this comment in a docker/libnetwork bug is to symlink resolv.conf to the new place for systemd’s file:

sudo mv /etc/resolv.conf{,.bak}
sudo ln -s /etc/resolv.conf /run/systemd/resolve/resolv.conf

This seems to have resolved it for me, and is reported as a fix by others. It’s a bit of a hack, and I’m not sure what other issues it’ll cause, but it seems to work so far :)



#docker #linux #ubuntu #DNS