summaryrefslogtreecommitdiff
path: root/libpod/container_internal_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-03 21:12:30 +0200
committerGitHub <noreply@github.com>2021-05-03 21:12:30 +0200
commit24156f95fb8a14a9d9f58b435b98ce552c2008b9 (patch)
tree069901076954f8ff5625c707212e34084a8d2e79 /libpod/container_internal_linux.go
parent697ec8f6f0ac8f251fd7f3f3bb5e21313ca62207 (diff)
parent17ce567c6827abdcd517699bc07e82ccf48f7619 (diff)
downloadpodman-24156f95fb8a14a9d9f58b435b98ce552c2008b9.tar.gz
podman-24156f95fb8a14a9d9f58b435b98ce552c2008b9.tar.bz2
podman-24156f95fb8a14a9d9f58b435b98ce552c2008b9.zip
Merge pull request #10177 from giuseppe/always-honor-cgroup-parent
cgroup: always honor --cgroup-parent
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r--libpod/container_internal_linux.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index f4762b5ff..f6045f881 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -2224,8 +2224,19 @@ func (c *Container) getOCICgroupPath() (string, error) {
}
cgroupManager := c.CgroupManager()
switch {
- case (rootless.IsRootless() && (cgroupManager == config.CgroupfsCgroupsManager || !unified)) || c.config.NoCgroups:
+ case c.config.NoCgroups:
return "", nil
+ case (rootless.IsRootless() && (cgroupManager == config.CgroupfsCgroupsManager || !unified)):
+ if c.config.CgroupParent == CgroupfsDefaultCgroupParent {
+ // old versions of podman were setting the CgroupParent to CgroupfsDefaultCgroupParent
+ // by default. Avoid breaking these versions and check whether the cgroup parent is
+ // set to the default and in this case enable the old behavior. It should not be a real
+ // problem because the default CgroupParent is usually owned by root so rootless users
+ // cannot access it.
+ // This check might be lifted in a future version of Podman.
+ return "", nil
+ }
+ return c.config.CgroupParent, nil
case c.config.CgroupsMode == cgroupSplit:
if c.config.CgroupParent != "" {
return c.config.CgroupParent, nil