$ docker run -ti --rm -m 300M --memory-swap=-1 ubuntu:14.04
WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.
root@813aafc019d5:/#
When we disable memoryswap, it should not warning swap limit not support.
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
| ... | ... |
@@ -33,7 +33,7 @@ func (daemon *Daemon) ContainerCreate(job *engine.Job) engine.Status {
|
| 33 | 33 |
job.Errorf("Your kernel does not support memory limit capabilities. Limitation discarded.\n")
|
| 34 | 34 |
hostConfig.Memory = 0 |
| 35 | 35 |
} |
| 36 |
- if hostConfig.Memory > 0 && !daemon.SystemConfig().SwapLimit {
|
|
| 36 |
+ if hostConfig.Memory > 0 && hostConfig.MemorySwap != -1 && !daemon.SystemConfig().SwapLimit {
|
|
| 37 | 37 |
job.Errorf("Your kernel does not support swap limit capabilities. Limitation discarded.\n")
|
| 38 | 38 |
hostConfig.MemorySwap = -1 |
| 39 | 39 |
} |