diff --git a/daemon/libnetwork/sandbox_dns_unix.go b/daemon/libnetwork/sandbox_dns_unix.go index ca18a75919..a5aac066e9 100644 --- a/daemon/libnetwork/sandbox_dns_unix.go +++ b/daemon/libnetwork/sandbox_dns_unix.go @@ -329,7 +329,15 @@ func (sb *Sandbox) rebuildDNS() error { // upstream nameservers. sb.setExternalResolvers(extNameServers) - return rc.WriteFile(sb.config.resolvConfPath, sb.config.resolvConfHashFile, filePerm) + // Write the file for the container - preserving old behaviour, not updating the + // hash file (so, no further updates will be made). + // TODO(robmry) - I think that's probably accidental, I can't find a reason for it, + // and the old resolvconf.Build() function wrote the file but not the hash, which + // is surprising. But, before fixing it, a guard/flag needs to be added to + // sb.updateDNS() to make sure that when an endpoint joins a sandbox that already + // has an internal resolver, the container's resolv.conf is still (re)configured + // for an internal resolver. + return rc.WriteFile(sb.config.resolvConfPath, "", filePerm) } func createBasePath(dir string) error {