Browse code

validate memory limits & error out if less than 512 KB

unclejack authored on 2013/06/15 01:46:04
Showing 1 changed files
... ...
@@ -652,6 +652,10 @@ func (srv *Server) ImageImport(src, repo, tag string, in io.Reader, out io.Write
652 652
 
653 653
 func (srv *Server) ContainerCreate(config *Config) (string, error) {
654 654
 
655
+	if config.Memory != 0 && config.Memory < 524288 {
656
+		return "", fmt.Errorf("Memory limit must be given in bytes (minimum 524288 bytes)")
657
+	}
658
+
655 659
 	if config.Memory > 0 && !srv.runtime.capabilities.MemoryLimit {
656 660
 		config.Memory = 0
657 661
 	}