Set minimum memory limit to 6M, to account for higher startup memory use
| ... | ... |
@@ -68,8 +68,8 @@ const ( |
| 68 | 68 |
linuxMinCPUShares = 2 |
| 69 | 69 |
linuxMaxCPUShares = 262144 |
| 70 | 70 |
platformSupported = true |
| 71 |
- // It's not kernel limit, we want this 4M limit to supply a reasonable functional container |
|
| 72 |
- linuxMinMemory = 4194304 |
|
| 71 |
+ // It's not kernel limit, we want this 6M limit to account for overhead during startup, and to supply a reasonable functional container |
|
| 72 |
+ linuxMinMemory = 6291456 |
|
| 73 | 73 |
// constants for remapped root settings |
| 74 | 74 |
defaultIDSpecifier = "default" |
| 75 | 75 |
defaultRemappedID = "dockremap" |
| ... | ... |
@@ -433,7 +433,7 @@ func verifyPlatformContainerResources(resources *containertypes.Resources, sysIn |
| 433 | 433 |
|
| 434 | 434 |
// memory subsystem checks and adjustments |
| 435 | 435 |
if resources.Memory != 0 && resources.Memory < linuxMinMemory {
|
| 436 |
- return warnings, fmt.Errorf("Minimum memory limit allowed is 4MB")
|
|
| 436 |
+ return warnings, fmt.Errorf("Minimum memory limit allowed is 6MB")
|
|
| 437 | 437 |
} |
| 438 | 438 |
if resources.Memory > 0 && !sysInfo.MemoryLimit {
|
| 439 | 439 |
warnings = append(warnings, "Your kernel does not support memory limit capabilities or the cgroup is not mounted. Limitation discarded.") |
| ... | ... |
@@ -871,7 +871,7 @@ func (s *DockerSuite) TestCreateWithTooLowMemoryLimit(c *testing.T) {
|
| 871 | 871 |
} else {
|
| 872 | 872 |
assert.Assert(c, res.StatusCode != http.StatusOK) |
| 873 | 873 |
} |
| 874 |
- assert.Assert(c, strings.Contains(string(b), "Minimum memory limit allowed is 4MB")) |
|
| 874 |
+ assert.Assert(c, strings.Contains(string(b), "Minimum memory limit allowed is 6MB")) |
|
| 875 | 875 |
} |
| 876 | 876 |
|
| 877 | 877 |
func (s *DockerSuite) TestContainerAPIRename(c *testing.T) {
|
| ... | ... |
@@ -2826,13 +2826,11 @@ func (s *DockerSuite) TestRunPIDHostWithChildIsKillable(c *testing.T) {
|
| 2826 | 2826 |
} |
| 2827 | 2827 |
|
| 2828 | 2828 |
func (s *DockerSuite) TestRunWithTooSmallMemoryLimit(c *testing.T) {
|
| 2829 |
- // TODO Windows. This may be possible to enable once Windows supports |
|
| 2830 |
- // memory limits on containers |
|
| 2829 |
+ // TODO Windows. This may be possible to enable once Windows supports memory limits on containers |
|
| 2831 | 2830 |
testRequires(c, DaemonIsLinux) |
| 2832 |
- // this memory limit is 1 byte less than the min, which is 4MB |
|
| 2833 |
- // https://github.com/docker/docker/blob/v1.5.0/daemon/create.go#L22 |
|
| 2834 |
- out, _, err := dockerCmdWithError("run", "-m", "4194303", "busybox")
|
|
| 2835 |
- if err == nil || !strings.Contains(out, "Minimum memory limit allowed is 4MB") {
|
|
| 2831 |
+ // this memory limit is 1 byte less than the min (daemon.linuxMinMemory), which is 6MB (6291456 bytes) |
|
| 2832 |
+ out, _, err := dockerCmdWithError("create", "-m", "6291455", "busybox")
|
|
| 2833 |
+ if err == nil || !strings.Contains(out, "Minimum memory limit allowed is 6MB") {
|
|
| 2836 | 2834 |
c.Fatalf("expected run to fail when using too low a memory limit: %q", out)
|
| 2837 | 2835 |
} |
| 2838 | 2836 |
} |
| ... | ... |
@@ -108,7 +108,7 @@ func (s *DockerSuite) TestUpdateContainerInvalidValue(c *testing.T) {
|
| 108 | 108 |
dockerCmd(c, "run", "-d", "--name", name, "-m", "300M", "busybox", "true") |
| 109 | 109 |
out, _, err := dockerCmdWithError("update", "-m", "2M", name)
|
| 110 | 110 |
assert.ErrorContains(c, err, "") |
| 111 |
- expected := "Minimum memory limit allowed is 4MB" |
|
| 111 |
+ expected := "Minimum memory limit allowed is 6MB" |
|
| 112 | 112 |
assert.Assert(c, strings.Contains(out, expected)) |
| 113 | 113 |
} |
| 114 | 114 |
|
| ... | ... |
@@ -175,7 +175,7 @@ func (s *DockerSuite) TestDeprecatedStartWithTooLowMemoryLimit(c *testing.T) {
|
| 175 | 175 |
} else {
|
| 176 | 176 |
assert.Equal(c, res.StatusCode, http.StatusBadRequest) |
| 177 | 177 |
} |
| 178 |
- assert.Assert(c, is.Contains(string(b), "Minimum memory limit allowed is 4MB")) |
|
| 178 |
+ assert.Assert(c, is.Contains(string(b), "Minimum memory limit allowed is 6MB")) |
|
| 179 | 179 |
} |
| 180 | 180 |
|
| 181 | 181 |
// #14640 |