mirror of
https://github.com/containers/podman.git
synced 2025-06-21 17:38:12 +08:00
Merge pull request #10734 from mgoltzsche/fix-dns-detection
Fix systemd-resolved detection.
This commit is contained in:
@ -1661,10 +1661,14 @@ func (c *Container) generateResolvConf() (string, error) {
|
|||||||
// check if systemd-resolved is used, assume it is used when 127.0.0.53 is the only nameserver
|
// check if systemd-resolved is used, assume it is used when 127.0.0.53 is the only nameserver
|
||||||
if len(ns) == 1 && ns[0] == "127.0.0.53" {
|
if len(ns) == 1 && ns[0] == "127.0.0.53" {
|
||||||
// read the actual resolv.conf file for systemd-resolved
|
// read the actual resolv.conf file for systemd-resolved
|
||||||
contents, err = ioutil.ReadFile("/run/systemd/resolve/resolv.conf")
|
resolvedContents, err := ioutil.ReadFile("/run/systemd/resolve/resolv.conf")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if !os.IsNotExist(err) {
|
||||||
return "", errors.Wrapf(err, "detected that systemd-resolved is in use, but could not locate real resolv.conf")
|
return "", errors.Wrapf(err, "detected that systemd-resolved is in use, but could not locate real resolv.conf")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
contents = resolvedContents
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ipv6 := false
|
ipv6 := false
|
||||||
|
Reference in New Issue
Block a user