Blame SOURCES/docker-1787148.patch

140861
diff -up docker-0be3e217c42ecf554bf5117bec9c832bd3f3b6fd/runc-66aedde759f33c190954815fb765eedc1d782dd9/libcontainer/cgroups/systemd/apply_systemd.go.orig docker-0be3e217c42ecf554bf5117bec9c832bd3f3b6fd/runc-66aedde759f33c190954815fb765eedc1d782dd9/libcontainer/cgroups/systemd/apply_systemd.go
140861
--- docker-0be3e217c42ecf554bf5117bec9c832bd3f3b6fd/runc-66aedde759f33c190954815fb765eedc1d782dd9/libcontainer/cgroups/systemd/apply_systemd.go.orig	2021-02-12 11:34:42.913036670 +0100
140861
+++ docker-0be3e217c42ecf554bf5117bec9c832bd3f3b6fd/runc-66aedde759f33c190954815fb765eedc1d782dd9/libcontainer/cgroups/systemd/apply_systemd.go	2021-02-12 11:37:14.165696606 +0100
140861
@@ -7,6 +7,7 @@ import (
140861
 	"fmt"
140861
 	"io/ioutil"
140861
 	"os"
140861
+	"os/exec"
140861
 	"path/filepath"
140861
 	"strings"
140861
 	"sync"
140861
@@ -130,6 +131,10 @@ func (m *Manager) Apply(pid int) error {
140861
 		properties = append(properties, newProp("PIDs", []uint32{uint32(pid)}))
140861
 	}
140861
 
140861
+	if systemdHasCollectMode() {
140861
+		properties = append(properties, newProp("CollectMode", "inactive-or-failed"))
140861
+	}
140861
+
140861
 	// This is only supported on systemd versions 218 and above.
140861
 	properties = append(properties, newProp("Delegate", true))
140861
 
140861
@@ -473,3 +478,13 @@ func isUnitExists(err error) bool {
140861
 	}
140861
 	return false
140861
 }
140861
+
140861
+func systemdHasCollectMode() bool {
140861
+	// This will show whether the currently running systemd supports CollectMode
140861
+	_, err := exec.Command("systemctl", "show", "-p", "CollectMode", "systemd").Output()
140861
+	if err != nil {
140861
+		logrus.Debugf("Failed to check systemd CollectMode: %v", err)
140861
+		return false
140861
+	}
140861
+	return true
140861
+}