summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2020-01-14 15:34:02 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2020-01-16 20:29:28 +0100
commit1951ff168a63157fa2f4711fde283edfc4981ed3 (patch)
tree3a731a232c5f38a00ee2cabea88fb4fd0df6121a
parent70236f56f9e8f2044e94800de7be3925f52d6c83 (diff)
downloadpodman-1951ff168a63157fa2f4711fde283edfc4981ed3.tar.gz
podman-1951ff168a63157fa2f4711fde283edfc4981ed3.tar.bz2
podman-1951ff168a63157fa2f4711fde283edfc4981ed3.zip
oci_conmon: do not create a cgroup under systemd
Detect whether we are running under systemd (if the INVOCATION_ID is set). If Podman is running under a systemd service, we do not need to create a cgroup for conmon. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r--libpod/oci_conmon_linux.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index 7c7ec8b2c..7cd42f9ab 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -1308,6 +1308,11 @@ func (r *ConmonOCIRuntime) moveConmonToCgroupAndSignal(ctr *Container, cmd *exec
mustCreateCgroup = false
}
+ // $INVOCATION_ID is set by systemd when running as a service.
+ if os.Getenv("INVOCATION_ID") != "" {
+ mustCreateCgroup = false
+ }
+
if mustCreateCgroup {
cgroupParent := ctr.CgroupParent()
if r.cgroupManager == define.SystemdCgroupsManager {