From 9ee11161bf0c635a0b0164ae1dee806c6fcfe7b7 Mon Sep 17 00:00:00 2001 From: unclejack Date: Fri, 14 Jun 2013 19:46:04 +0300 Subject: [PATCH] validate memory limits & error out if less than 512 KB --- server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server.go b/server.go index 34d525a35a..330c9fbb89 100644 --- a/server.go +++ b/server.go @@ -652,6 +652,10 @@ func (srv *Server) ImageImport(src, repo, tag string, in io.Reader, out io.Write func (srv *Server) ContainerCreate(config *Config) (string, error) { + if config.Memory != 0 && config.Memory < 524288 { + return "", fmt.Errorf("Memory limit must be given in bytes (minimum 524288 bytes)") + } + if config.Memory > 0 && !srv.runtime.capabilities.MemoryLimit { config.Memory = 0 }