diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-03-11 00:54:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-11 00:54:38 -0700 |
commit | 349e6911497a95a6a8121524b56704fe680f2b09 (patch) | |
tree | 69c634978e14f258a1cb78fbb1167c3d19e6b552 /libpod/container_internal_linux.go | |
parent | d95f97a63e03b4602ffeb80acb746fa6dfa6f7a1 (diff) | |
parent | 54fd1a7bb962fbce828dd2fb2295518e3c706d8f (diff) | |
download | podman-349e6911497a95a6a8121524b56704fe680f2b09.tar.gz podman-349e6911497a95a6a8121524b56704fe680f2b09.tar.bz2 podman-349e6911497a95a6a8121524b56704fe680f2b09.zip |
Merge pull request #2603 from mheon/misc_pod_fixes
Misc pod fixes
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r-- | libpod/container_internal_linux.go | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index f50092550..c9f35dd75 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -665,18 +665,21 @@ func (c *Container) makeBindMounts() error { if !netDisabled { // If /etc/resolv.conf and /etc/hosts exist, delete them so we - // will recreate - if path, ok := c.state.BindMounts["/etc/resolv.conf"]; ok { - if err := os.Remove(path); err != nil && !os.IsNotExist(err) { - return errors.Wrapf(err, "error removing container %s resolv.conf", c.ID()) + // will recreate. Only do this if we aren't sharing them with + // another container. + if c.config.NetNsCtr == "" { + if path, ok := c.state.BindMounts["/etc/resolv.conf"]; ok { + if err := os.Remove(path); err != nil && !os.IsNotExist(err) { + return errors.Wrapf(err, "error removing container %s resolv.conf", c.ID()) + } + delete(c.state.BindMounts, "/etc/resolv.conf") } - delete(c.state.BindMounts, "/etc/resolv.conf") - } - if path, ok := c.state.BindMounts["/etc/hosts"]; ok { - if err := os.Remove(path); err != nil && !os.IsNotExist(err) { - return errors.Wrapf(err, "error removing container %s hosts", c.ID()) + if path, ok := c.state.BindMounts["/etc/hosts"]; ok { + if err := os.Remove(path); err != nil && !os.IsNotExist(err) { + return errors.Wrapf(err, "error removing container %s hosts", c.ID()) + } + delete(c.state.BindMounts, "/etc/hosts") } - delete(c.state.BindMounts, "/etc/hosts") } if c.config.NetNsCtr != "" { |