diff --git a/cmd/containerd-shim-runc-v2/process/init.go b/cmd/containerd-shim-runc-v2/process/init.go index 10da7d798cab..648ae608383c 100644 --- a/cmd/containerd-shim-runc-v2/process/init.go +++ b/cmd/containerd-shim-runc-v2/process/init.go @@ -206,6 +206,10 @@ func (p *Init) validateIDMapMounts(ctx context.Context, spec *specs.Spec) error used = true break } + if sliceContainsStr(m.Options, "idmap") || sliceContainsStr(m.Options, "ridmap") { + used = true + break + } } if !used { @@ -552,3 +556,12 @@ func withConditionalIO(c stdio.Stdio) runc.IOOpt { o.OpenStderr = c.Stderr != "" } } + +func sliceContainsStr(s []string, str string) bool { + for _, s := range s { + if s == str { + return true + } + } + return false +}