summaryrefslogtreecommitdiff
path: root/libpod/oci_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-22 02:02:34 -0700
committerGitHub <noreply@github.com>2019-03-22 02:02:34 -0700
commit54b901fdda9b4ad21d866a12e3e13567d7f8a908 (patch)
tree04ffcf5979fc8261e40d780843906efde7f9065b /libpod/oci_linux.go
parent68e3df37248da85f58662c00e0934d1359f0fdc0 (diff)
parent7f6f2f3f4a764f8e566752e61092254bd285424b (diff)
downloadpodman-54b901fdda9b4ad21d866a12e3e13567d7f8a908.tar.gz
podman-54b901fdda9b4ad21d866a12e3e13567d7f8a908.tar.bz2
podman-54b901fdda9b4ad21d866a12e3e13567d7f8a908.zip
Merge pull request #2716 from giuseppe/fix-volumes-userns
userns: mount the volumes from the intermediate namespace
Diffstat (limited to 'libpod/oci_linux.go')
-rw-r--r--libpod/oci_linux.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/libpod/oci_linux.go b/libpod/oci_linux.go
index 2737a641e..f85c5ee62 100644
--- a/libpod/oci_linux.go
+++ b/libpod/oci_linux.go
@@ -106,6 +106,23 @@ func (r *OCIRuntime) createContainer(ctr *Container, cgroupParent string, restor
if err != nil {
return
}
+
+ if ctr.state.UserNSRoot != "" {
+ _, err := os.Stat(ctr.runtime.config.VolumePath)
+ if err != nil && !os.IsNotExist(err) {
+ return
+ }
+ if err == nil {
+ volumesTarget := filepath.Join(ctr.state.UserNSRoot, "volumes")
+ if err := idtools.MkdirAs(volumesTarget, 0700, ctr.RootUID(), ctr.RootGID()); err != nil {
+ return
+ }
+ if err = unix.Mount(ctr.runtime.config.VolumePath, volumesTarget, "none", unix.MS_BIND, ""); err != nil {
+ return
+ }
+ }
+ }
+
err = r.createOCIContainer(ctr, cgroupParent, restoreOptions)
}()
wg.Wait()