summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2020-10-22 19:21:07 +0200
committerPaul Holzinger <paul.holzinger@web.de>2020-10-22 19:21:07 +0200
commitf391849c2282bba0b28f9bee5a7be5bff7bac623 (patch)
treecf44e675941995253f6046417e0e264aedf6799b
parentd340f8523c9610644c8a195d1e3e9b3a5d32c5b3 (diff)
downloadpodman-f391849c2282bba0b28f9bee5a7be5bff7bac623.tar.gz
podman-f391849c2282bba0b28f9bee5a7be5bff7bac623.tar.bz2
podman-f391849c2282bba0b28f9bee5a7be5bff7bac623.zip
Don't error if resolv.conf does not exists
If the resolv.conf file is empty we provide default dns servers. If the file does not exists we error and don't create the container. We should also provide the default entries in this case. This is also what docker does. Fixes #8089 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
-rw-r--r--libpod/container_internal_linux.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 2efe0d086..a1b4334fb 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -1412,7 +1412,8 @@ func (c *Container) generateResolvConf() (string, error) {
// Determine the endpoint for resolv.conf in case it is a symlink
resolvPath, err := filepath.EvalSymlinks(resolvConf)
- if err != nil {
+ // resolv.conf doesn't have to exists
+ if err != nil && !os.IsNotExist(err) {
return "", err
}
@@ -1422,7 +1423,8 @@ func (c *Container) generateResolvConf() (string, error) {
}
contents, err := ioutil.ReadFile(resolvPath)
- if err != nil {
+ // resolv.conf doesn't have to exists
+ if err != nil && !os.IsNotExist(err) {
return "", errors.Wrapf(err, "unable to read %s", resolvPath)
}