diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-27 09:27:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-27 09:27:47 +0000 |
commit | 5afcaeeaef8c4e45712ca957e0c224bc997b3797 (patch) | |
tree | 32f43408cf6cd67573defbf0cbc39b0bd48e20d2 | |
parent | 4d0b583340c37efbf175c00d75d75107a0b23f00 (diff) | |
parent | a2e834d0d9090091211f456a0279221c0aa7f12e (diff) | |
download | podman-5afcaeeaef8c4e45712ca957e0c224bc997b3797.tar.gz podman-5afcaeeaef8c4e45712ca957e0c224bc997b3797.tar.bz2 podman-5afcaeeaef8c4e45712ca957e0c224bc997b3797.zip |
Merge pull request #9835 from ntkme/check-userns-support
[NO TESTS NEEDED] Fix for kernel without CONFIG_USER_NS
-rw-r--r-- | libpod/container_internal_linux.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index 94c6c3840..a136fb72d 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -607,10 +607,16 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { availableUIDs, availableGIDs, err := rootless.GetAvailableIDMaps() if err != nil { - return nil, err + if os.IsNotExist(err) { + // The kernel-provided files only exist if user namespaces are supported + logrus.Debugf("user or group ID mappings not available: %s", err) + } else { + return nil, err + } + } else { + g.Config.Linux.UIDMappings = rootless.MaybeSplitMappings(g.Config.Linux.UIDMappings, availableUIDs) + g.Config.Linux.GIDMappings = rootless.MaybeSplitMappings(g.Config.Linux.GIDMappings, availableGIDs) } - g.Config.Linux.UIDMappings = rootless.MaybeSplitMappings(g.Config.Linux.UIDMappings, availableUIDs) - g.Config.Linux.GIDMappings = rootless.MaybeSplitMappings(g.Config.Linux.GIDMappings, availableGIDs) // Hostname handling: // If we have a UTS namespace, set Hostname in the OCI spec. |