summaryrefslogtreecommitdiff
path: root/libpod/container_internal_linux.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-08-10 14:46:59 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-10 21:18:19 +0000
commit92e9d7891e2d68b119936509e780f3a3d93d8780 (patch)
tree6ff6f8a39f51cb5e365704a48bde49e8265853d7 /libpod/container_internal_linux.go
parent8b2d38ee842775fe6bbd72c166eaaceec91c2a65 (diff)
downloadpodman-92e9d7891e2d68b119936509e780f3a3d93d8780.tar.gz
podman-92e9d7891e2d68b119936509e780f3a3d93d8780.tar.bz2
podman-92e9d7891e2d68b119936509e780f3a3d93d8780.zip
We need to sort mounts so that one mount does not over mount another.
Currently we add mounts from images, volumes and internal. We can accidently over mount an existing mount. This patch sorts the mounts to make sure a parent directory is always mounted before its content. Had to change the default propagation on image volume mounts from shared to private to stop mount points from leaking out of the container. Also switched from using some docker/docker/pkg to container/storage/pkg to remove some dependencies on Docker. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #1243 Approved by: mheon
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r--libpod/container_internal_linux.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index e7e3b6ce9..59fb6af87 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -248,6 +248,12 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
g.SetLinuxCgroupsPath(cgroupPath)
}
+ // Mounts need to be sorted so paths will not cover other paths
+ mounts := sortMounts(g.Mounts())
+ g.ClearMounts()
+ for _, m := range mounts {
+ g.AddMount(m)
+ }
return g.Config, nil
}