summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorなつき <i@ntk.me>2021-03-26 13:25:58 -0700
committerMatthew Heon <mheon@redhat.com>2021-03-29 11:29:45 -0400
commit66b1c2bd998e0b0118e56a4dea7880a4eeada998 (patch)
tree62c591cbc87280733ef99c35c65512733b4e4e44
parentb5573018073b22b923d88efc853f8f1c35ca8119 (diff)
downloadpodman-66b1c2bd998e0b0118e56a4dea7880a4eeada998.tar.gz
podman-66b1c2bd998e0b0118e56a4dea7880a4eeada998.tar.bz2
podman-66b1c2bd998e0b0118e56a4dea7880a4eeada998.zip
[NO TESTS NEEDED] Fix for kernel without CONFIG_USER_NS
Signed-off-by: Natsuki <i@ntk.me>
-rw-r--r--libpod/container_internal_linux.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 24319f4b5..0fd29e456 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.