summaryrefslogtreecommitdiff
path: root/libpod/oci_conmon_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-01-22 17:00:48 +0100
committerGitHub <noreply@github.com>2020-01-22 17:00:48 +0100
commit9f146b1b54736ec1b683e3a7381c85d10b1a66a3 (patch)
treedd2ff39128e9aa3ba5bf67c7abc69aa59020f6b7 /libpod/oci_conmon_linux.go
parent105a42a2a46529312205cf852fa127627f8915e3 (diff)
parent1951ff168a63157fa2f4711fde283edfc4981ed3 (diff)
downloadpodman-9f146b1b54736ec1b683e3a7381c85d10b1a66a3.tar.gz
podman-9f146b1b54736ec1b683e3a7381c85d10b1a66a3.tar.bz2
podman-9f146b1b54736ec1b683e3a7381c85d10b1a66a3.zip
Merge pull request #4861 from giuseppe/add-cgroups-disabled-conmon
oci_conmon: do not create a cgroup under systemd
Diffstat (limited to 'libpod/oci_conmon_linux.go')
-rw-r--r--libpod/oci_conmon_linux.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index 0e8a64865..722012386 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -1425,11 +1425,22 @@ func startCommandGivenSelinux(cmd *exec.Cmd) error {
// it then signals for conmon to start by sending nonse data down the start fd
func (r *ConmonOCIRuntime) moveConmonToCgroupAndSignal(ctr *Container, cmd *exec.Cmd, startFd *os.File) error {
mustCreateCgroup := true
- // If cgroup creation is disabled - just signal.
+
if ctr.config.NoCgroups {
mustCreateCgroup = false
}
+ // If cgroup creation is disabled - just signal.
+ switch ctr.config.CgroupsMode {
+ case "disabled", "no-conmon":
+ 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 {