Browse code

Merge pull request #38579 from thaJeztah/fix_net_host_systemd_resolved

Fix: network=host using wrong resolv.conf with systemd-resolved

Tibor Vass authored on 2019/03/22 07:34:48
Showing 1 changed files
... ...
@@ -379,11 +379,11 @@ func (daemon *Daemon) setupPathsAndSandboxOptions(container *container.Container
379 379
 	if container.HostConfig.NetworkMode.IsHost() {
380 380
 		// Point to the host files, so that will be copied into the container running in host mode
381 381
 		*sboxOptions = append(*sboxOptions, libnetwork.OptionOriginHostsPath("/etc/hosts"))
382
-		*sboxOptions = append(*sboxOptions, libnetwork.OptionOriginResolvConfPath("/etc/resolv.conf"))
383
-	} else {
384
-		*sboxOptions = append(*sboxOptions, libnetwork.OptionOriginResolvConfPath(daemon.configStore.GetResolvConf()))
385 382
 	}
386 383
 
384
+	// Copy the host's resolv.conf for the container (/etc/resolv.conf or /run/systemd/resolve/resolv.conf)
385
+	*sboxOptions = append(*sboxOptions, libnetwork.OptionOriginResolvConfPath(daemon.configStore.GetResolvConf()))
386
+
387 387
 	container.HostsPath, err = container.GetRootResourcePath("hosts")
388 388
 	if err != nil {
389 389
 		return err