summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-24 09:21:41 -0400
committerGitHub <noreply@github.com>2020-06-24 09:21:41 -0400
commit3df30ef358e3211d4d6812ab08e9ceb1e31a771a (patch)
tree0dee6fb99d89cd17fb9c159f0a87e55147e64610 /libpod/container_internal.go
parent0d26b8f24babcd847a7412907e622514925544a4 (diff)
parent370195cf784967014dceee1f3da06f79170f033a (diff)
downloadpodman-3df30ef358e3211d4d6812ab08e9ceb1e31a771a.tar.gz
podman-3df30ef358e3211d4d6812ab08e9ceb1e31a771a.tar.bz2
podman-3df30ef358e3211d4d6812ab08e9ceb1e31a771a.zip
Merge pull request #6743 from giuseppe/specify-mappings-to-storage
libpod: specify mappings to the storage
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 73e0b2118..db64f5eeb 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -22,6 +22,7 @@ import (
"github.com/containers/libpod/pkg/selinux"
"github.com/containers/storage"
"github.com/containers/storage/pkg/archive"
+ "github.com/containers/storage/pkg/idtools"
"github.com/containers/storage/pkg/mount"
securejoin "github.com/cyphar/filepath-securejoin"
spec "github.com/opencontainers/runtime-spec/specs-go"
@@ -360,6 +361,25 @@ func (c *Container) setupStorageMapping(dest, from *storage.IDMappingOptions) {
}
dest.AutoUserNsOpts.InitialSize = initialSize + 1
}
+ } else if c.config.Spec.Linux != nil {
+ dest.UIDMap = nil
+ for _, r := range c.config.Spec.Linux.UIDMappings {
+ u := idtools.IDMap{
+ ContainerID: int(r.ContainerID),
+ HostID: int(r.HostID),
+ Size: int(r.Size),
+ }
+ dest.UIDMap = append(dest.UIDMap, u)
+ }
+ dest.GIDMap = nil
+ for _, r := range c.config.Spec.Linux.GIDMappings {
+ g := idtools.IDMap{
+ ContainerID: int(r.ContainerID),
+ HostID: int(r.HostID),
+ Size: int(r.Size),
+ }
+ dest.GIDMap = append(dest.GIDMap, g)
+ }
}
}