1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

add check for memoryswap when create

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
Qiang Huang 2015-01-23 11:29:21 +08:00
parent 6dd2364dc2
commit 72f356be6a

View file

@ -33,6 +33,9 @@ func (daemon *Daemon) ContainerCreate(job *engine.Job) engine.Status {
if config.Memory > 0 && config.MemorySwap > 0 && config.MemorySwap < config.Memory {
return job.Errorf("Minimum memoryswap limit should be larger than memory limit, see usage.\n")
}
if config.Memory == 0 && config.MemorySwap > 0 {
return job.Errorf("You should always set the Memory limit when using Memoryswap limit, see usage.\n")
}
var hostConfig *runconfig.HostConfig
if job.EnvExists("HostConfig") {