validate memory limits & error out if less than 512 KB

This commit is contained in:
unclejack 2013-06-14 19:46:04 +03:00
parent 452128f0da
commit 9ee11161bf
1 changed files with 4 additions and 0 deletions

View File

@ -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
}