aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-01-06 15:41:36 -0500
committerGitHub <noreply@github.com>2021-01-06 15:41:36 -0500
commitbb82c37b731f06b9e0602400cf0657a90a2d7537 (patch)
treeb6f6d7d1ee62d15192bddbd246dbd9258433f418 /libpod
parent8e4613ab0a57cf19f63d00a6426a9dee2489d3e6 (diff)
parent64571ea0a4e70006c727c652b20cdda847b9af29 (diff)
downloadpodman-bb82c37b731f06b9e0602400cf0657a90a2d7537.tar.gz
podman-bb82c37b731f06b9e0602400cf0657a90a2d7537.tar.bz2
podman-bb82c37b731f06b9e0602400cf0657a90a2d7537.zip
Merge pull request #8805 from giuseppe/single-user-mapped-root
libpod: handle single user mapped as root
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 96a21736c..58bf95470 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -1012,6 +1012,9 @@ func (c *Container) IDMappings() (storage.IDMappingOptions, error) {
// RootUID returns the root user mapping from container
func (c *Container) RootUID() int {
+ if len(c.config.IDMappings.UIDMap) == 1 && c.config.IDMappings.UIDMap[0].Size == 1 {
+ return c.config.IDMappings.UIDMap[0].HostID
+ }
for _, uidmap := range c.config.IDMappings.UIDMap {
if uidmap.ContainerID == 0 {
return uidmap.HostID
@@ -1022,6 +1025,9 @@ func (c *Container) RootUID() int {
// RootGID returns the root user mapping from container
func (c *Container) RootGID() int {
+ if len(c.config.IDMappings.GIDMap) == 1 && c.config.IDMappings.GIDMap[0].Size == 1 {
+ return c.config.IDMappings.GIDMap[0].HostID
+ }
for _, gidmap := range c.config.IDMappings.GIDMap {
if gidmap.ContainerID == 0 {
return gidmap.HostID