diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-06-21 07:06:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-21 07:06:34 -0400 |
commit | 18bf92f7ea2fcebb0b3403432ee703ced0f923c0 (patch) | |
tree | 0b3c0d162a24a0bb167884532e3d22d9a090127e /libpod | |
parent | 9ec4d04592a7a7a833e4eefbe14e77af2da1f92d (diff) | |
parent | 0fb165ed087c8ffc0ad01efab206c98bd27960f7 (diff) | |
download | podman-18bf92f7ea2fcebb0b3403432ee703ced0f923c0.tar.gz podman-18bf92f7ea2fcebb0b3403432ee703ced0f923c0.tar.bz2 podman-18bf92f7ea2fcebb0b3403432ee703ced0f923c0.zip |
Merge pull request #10734 from mgoltzsche/fix-dns-detection
Fix systemd-resolved detection.
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal_linux.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index c127cd3e6..25db3cff0 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -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 } } |