mirror of
https://github.com/docker/docs.git
synced 2026-03-31 00:08:55 +07:00
Merge pull request #11844 from jbarbier/cgroup-parent-42
Adding cgroup-parent option for docker build
This commit is contained in:
@@ -5322,3 +5322,30 @@ func (s *DockerSuite) TestBuildEmptyStringVolume(c *check.C) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestBuildContainerWithCgroupParent(c *check.C) {
|
||||
testRequires(c, NativeExecDriver)
|
||||
testRequires(c, SameHostDaemon)
|
||||
defer deleteImages()
|
||||
|
||||
cgroupParent := "test"
|
||||
data, err := ioutil.ReadFile("/proc/self/cgroup")
|
||||
if err != nil {
|
||||
c.Fatalf("failed to read '/proc/self/cgroup - %v", err)
|
||||
}
|
||||
selfCgroupPaths := parseCgroupPaths(string(data))
|
||||
_, found := selfCgroupPaths["memory"]
|
||||
if !found {
|
||||
c.Fatalf("unable to find self cpu cgroup path. CgroupsPath: %v", selfCgroupPaths)
|
||||
}
|
||||
cmd := exec.Command(dockerBinary, "build", "--cgroup-parent", cgroupParent, "-")
|
||||
cmd.Stdin = strings.NewReader(`
|
||||
FROM busybox
|
||||
RUN cat /proc/self/cgroup
|
||||
`)
|
||||
|
||||
out, _, err := runCommandWithOutput(cmd)
|
||||
if err != nil {
|
||||
c.Fatalf("unexpected failure when running container with --cgroup-parent option - %s\n%v", string(out), err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user