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>
This commit is contained in:
Giuseppe Scrivano
2020-01-14 15:34:02 +01:00
parent 70236f56f9
commit 1951ff168a

View File

@ -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 {