Browse code

Merge pull request #8173 from crosbymichael/update-mem-limit

Update memory limit for container

unclejack authored on 2014/09/25 02:55:25
Showing 2 changed files
... ...
@@ -15,8 +15,8 @@ func (daemon *Daemon) ContainerCreate(job *engine.Job) engine.Status {
15 15
 		return job.Errorf("Usage: %s", job.Name)
16 16
 	}
17 17
 	config := runconfig.ContainerConfigFromJob(job)
18
-	if config.Memory != 0 && config.Memory < 524288 {
19
-		return job.Errorf("Minimum memory limit allowed is 512k")
18
+	if config.Memory != 0 && config.Memory < 4194304 {
19
+		return job.Errorf("Minimum memory limit allowed is 4MB")
20 20
 	}
21 21
 	if config.Memory > 0 && !daemon.SystemConfig().MemoryLimit {
22 22
 		job.Errorf("Your kernel does not support memory limit capabilities. Limitation discarded.\n")
... ...
@@ -40,7 +40,7 @@ func TestRunEchoStdout(t *testing.T) {
40 40
 
41 41
 // "test" should be printed
42 42
 func TestRunEchoStdoutWithMemoryLimit(t *testing.T) {
43
-	runCmd := exec.Command(dockerBinary, "run", "-m", "2786432", "busybox", "echo", "test")
43
+	runCmd := exec.Command(dockerBinary, "run", "-m", "4m", "busybox", "echo", "test")
44 44
 	out, _, _, err := runCommandWithStdoutStderr(runCmd)
45 45
 	if err != nil {
46 46
 		t.Fatalf("failed to run container: %v, output: %q", err, out)
... ...
@@ -77,7 +77,7 @@ func TestRunEchoStdoutWitCPULimit(t *testing.T) {
77 77
 
78 78
 // "test" should be printed
79 79
 func TestRunEchoStdoutWithCPUAndMemoryLimit(t *testing.T) {
80
-	runCmd := exec.Command(dockerBinary, "run", "-c", "1000", "-m", "2786432", "busybox", "echo", "test")
80
+	runCmd := exec.Command(dockerBinary, "run", "-c", "1000", "-m", "4m", "busybox", "echo", "test")
81 81
 	out, _, _, err := runCommandWithStdoutStderr(runCmd)
82 82
 	if err != nil {
83 83
 		t.Fatalf("failed to run container: %v, output: %q", err, out)