Skip to content

Commit

Permalink
Merge pull request #10734 from mgoltzsche/fix-dns-detection
Browse files Browse the repository at this point in the history
Fix systemd-resolved detection.
  • Loading branch information
openshift-merge-robot authored Jun 21, 2021
2 parents 9ec4d04 + 0fb165e commit 18bf92f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libpod/container_internal_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1661,9 +1661,13 @@ 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
if len(ns) == 1 && ns[0] == "127.0.0.53" {
// 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 {
return "", errors.Wrapf(err, "detected that systemd-resolved is in use, but could not locate real resolv.conf")
if !os.IsNotExist(err) {
return "", errors.Wrapf(err, "detected that systemd-resolved is in use, but could not locate real resolv.conf")
}
} else {
contents = resolvedContents
}
}

Expand Down

0 comments on commit 18bf92f

Please sign in to comment.