summaryrefslogtreecommitdiff
path: root/pkg/spec
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/spec')
-rw-r--r--pkg/spec/spec.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go
index 8d8a07a2e..8038dd6ba 100644
--- a/pkg/spec/spec.go
+++ b/pkg/spec/spec.go
@@ -27,7 +27,10 @@ func CreateConfigToOCISpec(config *CreateConfig) (*spec.Spec, error) { //nolint
addCgroup := true
canMountSys := true
- if !config.UsernsMode.IsHost() && config.NetMode.IsHost() {
+ isRootless := rootless.IsRootless()
+ inUserNS := isRootless || (len(config.IDMappings.UIDMap) > 0 || len(config.IDMappings.GIDMap) > 0) && !config.UsernsMode.IsHost()
+
+ if inUserNS && config.NetMode.IsHost() {
canMountSys = false
}
@@ -56,7 +59,7 @@ func CreateConfigToOCISpec(config *CreateConfig) (*spec.Spec, error) { //nolint
}
g.AddMount(sysMnt)
}
- if rootless.IsRootless() {
+ if isRootless {
g.RemoveMount("/dev/pts")
devPts := spec.Mount{
Destination: "/dev/pts",