Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd: dockerd: make systemd specific cgroups tweaks build-time optional
When running under systemd, we have to do some tweaks for systemd's non standard cgroups setups. This isn't required if we'll never be running in such an environment (eg. there're many distros free of such Lennartisms). Therefore make it possible to opt out at build time by settings the 'no_systemd' tag. changes v2: fixed danling import renamed 'nosystemd' tag to 'no_systemd' Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
- Loading branch information
Showing
3 changed files
with
38 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// +build no_systemd | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/docker/docker/daemon/config" | ||
) | ||
|
||
func newCgroupParent(config *config.Config) string { | ||
cgroupParent := "docker" | ||
if config.CgroupParent != "" { | ||
cgroupParent = config.CgroupParent | ||
} | ||
return cgroupParent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// +build linux,!no_systemd | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/docker/docker/daemon" | ||
"github.com/docker/docker/daemon/config" | ||
) | ||
|
||
func newCgroupParent(config *config.Config) string { | ||
cgroupParent := "docker" | ||
useSystemd := daemon.UsingSystemd(config) | ||
if useSystemd { | ||
cgroupParent = "system.slice" | ||
} | ||
if config.CgroupParent != "" { | ||
cgroupParent = config.CgroupParent | ||
} | ||
if useSystemd { | ||
cgroupParent = cgroupParent + ":" + "docker" + ":" | ||
} | ||
return cgroupParent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters