From 6831db7f10cc00e3b8de8ab1e126ad228d2a9329 Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 26 Feb 2018 09:34:45 -0600 Subject: Do not override user mounts Podman should not override users mounts with default mounts for /etc/hostname, /etc/resolv.conf, and /etc/hosts. Resolves issue #388 Signed-off-by: baude Closes: #401 Approved by: mheon --- libpod/container_internal.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libpod') diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 3709e4138..37a70a152 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -573,7 +573,9 @@ func (c *Container) generateSpec(resolvPath, hostsPath, hostnamePath string) (*s Destination: "/etc/resolv.conf", Options: []string{"rw", "bind"}, } - g.AddMount(resolvMnt) + if !MountExists(g.Mounts(), resolvMnt.Destination) { + g.AddMount(resolvMnt) + } // Bind mount hosts hostsMnt := spec.Mount{ Type: "bind", @@ -581,7 +583,9 @@ func (c *Container) generateSpec(resolvPath, hostsPath, hostnamePath string) (*s Destination: "/etc/hosts", Options: []string{"rw", "bind"}, } - g.AddMount(hostsMnt) + if !MountExists(g.Mounts(), hostsMnt.Destination) { + g.AddMount(hostsMnt) + } // Bind hostname hostnameMnt := spec.Mount{ Type: "bind", @@ -589,7 +593,9 @@ func (c *Container) generateSpec(resolvPath, hostsPath, hostnamePath string) (*s Destination: "/etc/hostname", Options: []string{"rw", "bind"}, } - g.AddMount(hostnameMnt) + if !MountExists(g.Mounts(), hostnameMnt.Destination) { + g.AddMount(hostnameMnt) + } // Bind builtin image volumes if c.config.ImageVolumes { -- cgit v1.2.3-54-g00ecf