summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-05-07 13:52:20 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-05-11 13:55:28 -0400
commit60dc80f9f372f3600c640e3995b1fc72ad862bbe (patch)
treeb4cf80db2180f5f82ee3d72328883892848d6ec9
parente9b178556d89fa7d483826fbfb59e1075081f800 (diff)
downloadpodman-60dc80f9f372f3600c640e3995b1fc72ad862bbe.tar.gz
podman-60dc80f9f372f3600c640e3995b1fc72ad862bbe.tar.bz2
podman-60dc80f9f372f3600c640e3995b1fc72ad862bbe.zip
Set pids-limit to 0 on non cgroupv2 rootless systems
Rootless cgroups V1 does not support setting a pids limit. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
-rw-r--r--cmd/podman/commands.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd/podman/commands.go b/cmd/podman/commands.go
index 2ee31b643..2aa9b94b8 100644
--- a/cmd/podman/commands.go
+++ b/cmd/podman/commands.go
@@ -7,6 +7,7 @@ import (
"os"
"github.com/containers/buildah/pkg/parse"
+ "github.com/containers/common/pkg/config"
"github.com/containers/libpod/pkg/apparmor"
"github.com/containers/libpod/pkg/cgroups"
"github.com/containers/libpod/pkg/rootless"
@@ -179,10 +180,13 @@ func getDefaultUserNS() string {
func getDefaultPidsLimit() int64 {
if rootless.IsRootless() {
- cgroup2, _ := cgroups.IsCgroup2UnifiedMode()
- if cgroup2 {
- return defaultContainerConfig.Containers.PidsLimit
+ if defaultContainerConfig.Engine.CgroupManager == config.SystemdCgroupsManager {
+ cgroup2, _ := cgroups.IsCgroup2UnifiedMode()
+ if cgroup2 {
+ return defaultContainerConfig.Containers.PidsLimit
+ }
}
+ return 0
}
return sysinfo.GetDefaultPidsLimit()
}