summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-02-26 09:34:45 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2018-02-26 18:46:44 +0000
commit6831db7f10cc00e3b8de8ab1e126ad228d2a9329 (patch)
tree32fb6481534bb30a3f1edfcea43120ad219ba8b4 /libpod/container_internal.go
parentb351b12e273cde1f6973420b5aa911c92c51db58 (diff)
downloadpodman-6831db7f10cc00e3b8de8ab1e126ad228d2a9329.tar.gz
podman-6831db7f10cc00e3b8de8ab1e126ad228d2a9329.tar.bz2
podman-6831db7f10cc00e3b8de8ab1e126ad228d2a9329.zip
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 <bbaude@redhat.com> Closes: #401 Approved by: mheon
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go12
1 files changed, 9 insertions, 3 deletions
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 {