summaryrefslogtreecommitdiff
path: root/libpod/container_internal_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/container_internal_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/container_internal_linux.go')
-rw-r--r--libpod/container_internal_linux.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 2a7808bdf..c6c9ceb0c 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -203,7 +203,8 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
}
// Check if the spec file mounts contain the label Relabel flags z or Z.
// If they do, relabel the source directory and then remove the option.
- for _, m := range g.Mounts() {
+ for i := range g.Config.Mounts {
+ m := &g.Config.Mounts[i]
var options []string
for _, o := range m.Options {
switch o {
@@ -219,6 +220,13 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
}
}
m.Options = options
+
+ // If we are using a user namespace, we will use an intermediate
+ // directory to bind mount volumes
+ if c.state.UserNSRoot != "" && strings.HasPrefix(m.Source, c.runtime.config.VolumePath) {
+ newSourceDir := filepath.Join(c.state.UserNSRoot, "volumes")
+ m.Source = strings.Replace(m.Source, c.runtime.config.VolumePath, newSourceDir, 1)
+ }
}
g.SetProcessSelinuxLabel(c.ProcessLabel())