mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix kernel memory limit
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
b8c21783f0
commit
dd7b4fd651
2 changed files with 4 additions and 1 deletions
|
@ -161,6 +161,7 @@ func SetupCgroups(container *configs.Config, c *Command) error {
|
|||
container.Cgroups.Memory = c.Resources.Memory
|
||||
container.Cgroups.MemoryReservation = c.Resources.MemoryReservation
|
||||
container.Cgroups.MemorySwap = c.Resources.MemorySwap
|
||||
container.Cgroups.KernelMemory = c.Resources.KernelMemory
|
||||
container.Cgroups.CpusetCpus = c.Resources.CpusetCpus
|
||||
container.Cgroups.CpusetMems = c.Resources.CpusetMems
|
||||
container.Cgroups.CpuPeriod = c.Resources.CPUPeriod
|
||||
|
|
|
@ -162,7 +162,9 @@ func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) {
|
|||
func (s *DockerSuite) TestRunWithKernelMemory(c *check.C) {
|
||||
testRequires(c, kernelMemorySupport)
|
||||
|
||||
dockerCmd(c, "run", "--kernel-memory", "50M", "--name", "test1", "busybox", "true")
|
||||
file := "/sys/fs/cgroup/memory/memory.kmem.limit_in_bytes"
|
||||
out, _ := dockerCmd(c, "run", "--kernel-memory", "50M", "--name", "test1", "busybox", "cat", file)
|
||||
c.Assert(out, checker.Contains, "52428800")
|
||||
|
||||
out, err := inspectField("test1", "HostConfig.KernelMemory")
|
||||
c.Assert(err, check.IsNil)
|
||||
|
|
Loading…
Reference in a new issue