mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #38579 from thaJeztah/fix_net_host_systemd_resolved
Fix: network=host using wrong resolv.conf with systemd-resolved
This commit is contained in:
commit
56bb8fb324
1 changed files with 3 additions and 3 deletions
|
@ -379,11 +379,11 @@ func (daemon *Daemon) setupPathsAndSandboxOptions(container *container.Container
|
||||||
if container.HostConfig.NetworkMode.IsHost() {
|
if container.HostConfig.NetworkMode.IsHost() {
|
||||||
// Point to the host files, so that will be copied into the container running in host mode
|
// Point to the host files, so that will be copied into the container running in host mode
|
||||||
*sboxOptions = append(*sboxOptions, libnetwork.OptionOriginHostsPath("/etc/hosts"))
|
*sboxOptions = append(*sboxOptions, libnetwork.OptionOriginHostsPath("/etc/hosts"))
|
||||||
*sboxOptions = append(*sboxOptions, libnetwork.OptionOriginResolvConfPath("/etc/resolv.conf"))
|
|
||||||
} else {
|
|
||||||
*sboxOptions = append(*sboxOptions, libnetwork.OptionOriginResolvConfPath(daemon.configStore.GetResolvConf()))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy the host's resolv.conf for the container (/etc/resolv.conf or /run/systemd/resolve/resolv.conf)
|
||||||
|
*sboxOptions = append(*sboxOptions, libnetwork.OptionOriginResolvConfPath(daemon.configStore.GetResolvConf()))
|
||||||
|
|
||||||
container.HostsPath, err = container.GetRootResourcePath("hosts")
|
container.HostsPath, err = container.GetRootResourcePath("hosts")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue