summaryrefslogtreecommitdiff
path: root/libpod/oci_internal_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-09-11 00:58:46 +0200
committerGitHub <noreply@github.com>2019-09-11 00:58:46 +0200
commit7ac6ed3b4b27621e7aa15da335e65ffa601fb83e (patch)
tree397083da135855ec39a94abd834fefc18079607a /libpod/oci_internal_linux.go
parent997c4b56ed2121726e966afe9a102ed16ba78f93 (diff)
parentc2284962c798a11f3c956ee237f27cfd3b0fcb21 (diff)
downloadpodman-7ac6ed3b4b27621e7aa15da335e65ffa601fb83e.tar.gz
podman-7ac6ed3b4b27621e7aa15da335e65ffa601fb83e.tar.bz2
podman-7ac6ed3b4b27621e7aa15da335e65ffa601fb83e.zip
Merge pull request #3581 from mheon/no_cgroups
Support running containers without CGroups
Diffstat (limited to 'libpod/oci_internal_linux.go')
-rw-r--r--libpod/oci_internal_linux.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/libpod/oci_internal_linux.go b/libpod/oci_internal_linux.go
index 48b7370e0..f9e935d86 100644
--- a/libpod/oci_internal_linux.go
+++ b/libpod/oci_internal_linux.go
@@ -263,7 +263,7 @@ func (r *OCIRuntime) configureConmonEnv(runtimeDir string) ([]string, []*os.File
func (r *OCIRuntime) sharedConmonArgs(ctr *Container, cuuid, bundlePath, pidPath, logPath, exitDir, ociLogPath string) []string {
// set the conmon API version to be able to use the correct sync struct keys
args := []string{"--api-version", "1"}
- if r.cgroupManager == SystemdCgroupsManager {
+ if r.cgroupManager == SystemdCgroupsManager && !ctr.config.NoCgroups {
args = append(args, "-s")
}
args = append(args, "-c", ctr.ID())
@@ -307,6 +307,10 @@ func (r *OCIRuntime) sharedConmonArgs(ctr *Container, cuuid, bundlePath, pidPath
if ociLogPath != "" {
args = append(args, "--runtime-arg", "--log-format=json", "--runtime-arg", "--log", fmt.Sprintf("--runtime-arg=%s", ociLogPath))
}
+ if ctr.config.NoCgroups {
+ logrus.Debugf("Running with no CGroups")
+ args = append(args, "--runtime-arg", "--cgroup-manager", "--runtime-arg", "disabled")
+ }
return args
}
@@ -355,6 +359,11 @@ func startCommandGivenSelinux(cmd *exec.Cmd) error {
// moveConmonToCgroupAndSignal gets a container's cgroupParent and moves the conmon process to that cgroup
// it then signals for conmon to start by sending nonse data down the start fd
func (r *OCIRuntime) moveConmonToCgroupAndSignal(ctr *Container, cmd *exec.Cmd, startFd *os.File, uuid string) error {
+ // If cgroup creation is disabled - just signal.
+ if ctr.config.NoCgroups {
+ return writeConmonPipeData(startFd)
+ }
+
cgroupParent := ctr.CgroupParent()
if r.cgroupManager == SystemdCgroupsManager {
unitName := createUnitName("libpod-conmon", ctr.ID())