Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions daemon/daemon_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const (
linuxMinCPUShares = 2
linuxMaxCPUShares = 262144
platformSupported = true
// It's not kernel limit, we want this 4M limit to supply a reasonable functional container
linuxMinMemory = 4194304
// It's not kernel limit, we want this 6M limit to account for overhead during startup, and to supply a reasonable functional container
linuxMinMemory = 6291456
// constants for remapped root settings
defaultIDSpecifier = "default"
defaultRemappedID = "dockremap"
Expand Down Expand Up @@ -433,7 +433,7 @@ func verifyPlatformContainerResources(resources *containertypes.Resources, sysIn

// memory subsystem checks and adjustments
if resources.Memory != 0 && resources.Memory < linuxMinMemory {
return warnings, fmt.Errorf("Minimum memory limit allowed is 4MB")
return warnings, fmt.Errorf("Minimum memory limit allowed is 6MB")
}
if resources.Memory > 0 && !sysInfo.MemoryLimit {
warnings = append(warnings, "Your kernel does not support memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
Expand Down
2 changes: 1 addition & 1 deletion integration-cli/docker_api_containers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *testing.T) {
} else {
assert.Assert(c, res.StatusCode != http.StatusOK)
}
assert.Assert(c, strings.Contains(string(b), "Minimum memory limit allowed is 4MB"))
assert.Assert(c, strings.Contains(string(b), "Minimum memory limit allowed is 6MB"))
}

func (s *DockerSuite) TestContainerAPIRename(c *testing.T) {
Expand Down
10 changes: 4 additions & 6 deletions integration-cli/docker_cli_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2826,13 +2826,11 @@ func (s *DockerSuite) TestRunPIDHostWithChildIsKillable(c *testing.T) {
}

func (s *DockerSuite) TestRunWithTooSmallMemoryLimit(c *testing.T) {
// TODO Windows. This may be possible to enable once Windows supports
// memory limits on containers
// TODO Windows. This may be possible to enable once Windows supports memory limits on containers
testRequires(c, DaemonIsLinux)
// this memory limit is 1 byte less than the min, which is 4MB
// https://github.com/docker/docker/blob/v1.5.0/daemon/create.go#L22
out, _, err := dockerCmdWithError("run", "-m", "4194303", "busybox")
if err == nil || !strings.Contains(out, "Minimum memory limit allowed is 4MB") {
// this memory limit is 1 byte less than the min (daemon.linuxMinMemory), which is 6MB (6291456 bytes)
out, _, err := dockerCmdWithError("create", "-m", "6291455", "busybox")
if err == nil || !strings.Contains(out, "Minimum memory limit allowed is 6MB") {
c.Fatalf("expected run to fail when using too low a memory limit: %q", out)
}
}
Expand Down
2 changes: 1 addition & 1 deletion integration-cli/docker_cli_update_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (s *DockerSuite) TestUpdateContainerInvalidValue(c *testing.T) {
dockerCmd(c, "run", "-d", "--name", name, "-m", "300M", "busybox", "true")
out, _, err := dockerCmdWithError("update", "-m", "2M", name)
assert.ErrorContains(c, err, "")
expected := "Minimum memory limit allowed is 4MB"
expected := "Minimum memory limit allowed is 6MB"
assert.Assert(c, strings.Contains(out, expected))
}

Expand Down
2 changes: 1 addition & 1 deletion integration-cli/docker_deprecated_api_v124_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (s *DockerSuite) TestDeprecatedStartWithTooLowMemoryLimit(c *testing.T) {
} else {
assert.Equal(c, res.StatusCode, http.StatusBadRequest)
}
assert.Assert(c, is.Contains(string(b), "Minimum memory limit allowed is 4MB"))
assert.Assert(c, is.Contains(string(b), "Minimum memory limit allowed is 6MB"))
}

// #14640
Expand Down