This little Docker peculiarity has tripped me up twice now; it got me again yesterday when I did a fresh install of ElementaryOS after they released Freya Beta 2.
There was a thing with Docker on Ubuntu where if your resolv.conf has
127.0.0.1 as the
nameserver (which it almost certainly does), then DNS lookups on containers would just fail. Docker fixed this with a workaround where all containers will have their nameservers overridden to point to Google DNS (
Except the corporate network I’m currently on uses OpenDNS, and has actually blocked the Google DNS IP addresses. Which meant that when my
docker build process tried to
kpm restore, it couldn’t find MyGet or NuGet or anything, resulting in a cascade of
I remembered having the problem before, and obviously I’d solved it, but I couldn’t remember how I solved it, so I figured it all out again from scratch, and now I’m posting it here for next time I reinstall Linux while working on a corporate network that blocks Google DNS:
/etc/default/docker (you’ll need
sudo for this) and uncomment the
DOCKER_OPTS line, which lets you specify the command line arguments that are passed to the
docker daemon when it starts. You can set the DNS servers using the
--dns switch, like this:
# Use DOCKER_OPTS to modify the daemon startup options. DOCKER_OPTS="--dns 126.96.36.199 --dns 188.8.131.52"
Easy when you know how.