Merge pull request #11428 from vishh/parent-cgroup

Adding '--cgroup-parent' option.
This commit is contained in:
Michael Crosby
2015-03-19 14:41:57 -07:00
10 changed files with 106 additions and 1 deletions
+6
View File
@@ -164,6 +164,7 @@ type Command struct {
MountLabel string `json:"mount_label"`
LxcConfig []string `json:"lxc_config"`
AppArmorProfile string `json:"apparmor_profile"`
CgroupParent string `json:"cgroup_parent"` // The parent cgroup for this command.
}
func InitContainer(c *Command) *configs.Config {
@@ -179,6 +180,11 @@ func InitContainer(c *Command) *configs.Config {
// check to see if we are running in ramdisk to disable pivot root
container.NoPivotRoot = os.Getenv("DOCKER_RAMDISK") != ""
// Default parent cgroup is "docker". Override if required.
if c.CgroupParent != "" {
container.Cgroups.Parent = c.CgroupParent
}
return container
}