Skip to content

Commit cbcc85d

Browse files
committed
runc: not require uid/gid mappings if euid()==0
When running in a new unserNS as root, don't require a mapping to be present in the configuration file. We are already skipping the test for a new userns to be present. Signed-off-by: Giuseppe Scrivano <[email protected]>
1 parent dd56ece commit cbcc85d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

libcontainer/configs/validate/rootless.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ func rootlessMappings(config *configs.Config) error {
4343
if !config.Namespaces.Contains(configs.NEWUSER) {
4444
return fmt.Errorf("rootless containers require user namespaces")
4545
}
46-
}
47-
48-
if len(config.UidMappings) == 0 {
49-
return fmt.Errorf("rootless containers requires at least one UID mapping")
50-
}
51-
if len(config.GidMappings) == 0 {
52-
return fmt.Errorf("rootless containers requires at least one GID mapping")
46+
if len(config.UidMappings) == 0 {
47+
return fmt.Errorf("rootless containers requires at least one UID mapping")
48+
}
49+
if len(config.GidMappings) == 0 {
50+
return fmt.Errorf("rootless containers requires at least one GID mapping")
51+
}
5352
}
5453

5554
return nil

0 commit comments

Comments
 (0)