mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add mount point to cgroup root when initializing cgroup paths for
cpu.rt_runtime PR https://github.com/docker/docker/pull/23430 introduced a couple more flags including `--cpu-rt-runtime` to the docker daemon. It appears recent changes or merge issues may have broken this. It currently does not take the cgroup mount point into account when determining the cgroup files to write values to. This breaks docker setting its own `cpu.rt_runtime` for the daemon. This also means containers aren't able to set theirs. Also, the cgroups.FindCgroupMountpointAndRoot returns back a mount point that includes the cgroup of the currently running container when docker is run inside a docker container. this breaks the `--cpu-rt-runtime` flag when running docker in docker. A fix has been placed here, but potentially could be pulled up into libcontainer if this is a better place for it. Signed-off-by: Erik St. Martin <alakriti@gmail.com>
This commit is contained in:
parent
1a24abe42d
commit
40e075532a
1 changed files with 7 additions and 2 deletions
|
@ -1269,12 +1269,17 @@ func (daemon *Daemon) initCgroupsPath(path string) error {
|
||||||
// for the period and runtime as this limits what the children can be set to.
|
// for the period and runtime as this limits what the children can be set to.
|
||||||
daemon.initCgroupsPath(filepath.Dir(path))
|
daemon.initCgroupsPath(filepath.Dir(path))
|
||||||
|
|
||||||
_, root, err := cgroups.FindCgroupMountpointAndRoot("cpu")
|
mnt, root, err := cgroups.FindCgroupMountpointAndRoot("cpu")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// When docker is run inside docker, the root is based of the host cgroup.
|
||||||
|
// Should this be handled in runc/libcontainer/cgroups ?
|
||||||
|
if strings.HasPrefix(root, "/docker/") {
|
||||||
|
root = "/"
|
||||||
|
}
|
||||||
|
|
||||||
path = filepath.Join(root, path)
|
path = filepath.Join(mnt, root, path)
|
||||||
sysinfo := sysinfo.New(true)
|
sysinfo := sysinfo.New(true)
|
||||||
if err := maybeCreateCPURealTimeFile(sysinfo.CPURealtimePeriod, daemon.configStore.CPURealtimePeriod, "cpu.rt_period_us", path); err != nil {
|
if err := maybeCreateCPURealTimeFile(sysinfo.CPURealtimePeriod, daemon.configStore.CPURealtimePeriod, "cpu.rt_period_us", path); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Add table
Reference in a new issue