Docker Running container with memory/swap limits


Example

Set memory limit and disable swap limit

docker run -it -m 300M --memory-swap -1 ubuntu:14.04 /bin/bash

Set both memory and swap limit. In this case, container can use 300M memory and 700M swap.

docker run -it -m 300M --memory-swap 1G ubuntu:14.04 /bin/bash