From 1951ff168a63157fa2f4711fde283edfc4981ed3 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Tue, 14 Jan 2020 15:34:02 +0100 Subject: 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 --- libpod/oci_conmon_linux.go | 5 +++++ 1 file changed, 5 insertions(+) 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 { -- cgit v1.2.3-54-g00ecf