Update container resolv.conf when host network changes /etc/resolv.conf

Only modifies non-running containers resolv.conf bind mount, and only if
the container has an unmodified resolv.conf compared to its contents at
container start time (so we don't overwrite manual/automated changes
within the container runtime). For containers which are running when
the host resolv.conf changes, the update will only be applied to the
container version of resolv.conf when the container is "bounced" down
and back up (e.g. stop/start or restart)

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
This commit is contained in:
Phil Estes
2015-01-08 14:15:13 -05:00
parent edbf1ed680
commit 63a7ccdd23
8 changed files with 426 additions and 51 deletions
-8
View File
@@ -290,14 +290,6 @@ func NewHTTPRequestError(msg string, res *http.Response) error {
}
}
var localHostRx = regexp.MustCompile(`(?m)^nameserver 127[^\n]+\n*`)
// RemoveLocalDns looks into the /etc/resolv.conf,
// and removes any local nameserver entries.
func RemoveLocalDns(resolvConf []byte) []byte {
return localHostRx.ReplaceAll(resolvConf, []byte{})
}
// An StatusError reports an unsuccessful exit by a command.
type StatusError struct {
Status string