summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-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 {