diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-06-24 11:25:47 +0200 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2020-06-24 14:43:00 -0400 |
commit | d94644d35a6b7056f75da28b8a090ca250e121db (patch) | |
tree | d08deafea1f3cc89e9a8b4bc6d7e2555b67c757f /libpod | |
parent | f425aede44a3e114565636ed33adccef62012fd3 (diff) | |
download | podman-d94644d35a6b7056f75da28b8a090ca250e121db.tar.gz podman-d94644d35a6b7056f75da28b8a090ca250e121db.tar.bz2 podman-d94644d35a6b7056f75da28b8a090ca250e121db.zip |
libpod: specify mappings to the storage
specify the mappings in the container configuration to the storage
when creating the container so that the correct mappings can be
configured.
Regression introduced with Podman 2.0.
Closes: https://github.com/containers/libpod/issues/6735
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal.go | 20 |
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) + } } } |