Run the following command,
docker run -it –rm -m 128m stress –vm 1 –vm-bytes 400M –vm-hang 0
Create a container and test Docker’s limit on container memory. The container system image is ubuntu 14.04.2. After operation, there are the following tips
WARNING: Your kernel does not support swap limit capabilities, memory limited without swap.
The container can operate normally and has not been terminated due to memory overflow.
Ask Daniel to help explain the reason.
This problem is well settled.
Adjust memory and swap accounting When users run Docker, they may see these messages when working with an image: WARNING: Your kernel does not support cgroup swap limit. WARNING: Your kernel does not support swap limit capabilities. Limitation discarded. To prevent these messages, enable memory and swap accounting on your system. To enable these on system using GNU GRUB (GNU GRand Unified Bootloader), do the following. Log into Ubuntu as a user with sudo privileges. Edit the /etc/default/grub file. Set the GRUB_CMDLINE_LINUX value as follows: GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1" Save and close the file. Update GRUB. $ sudo update-grub Reboot your system.