Tag Archives: WARNING: No swap limit support

[Solved] docker info Check Error: WARNING: No swap limit support

Docker can limit the maximum physical memory and swap that can be used by the container by starting the command. However, the warning “warning: no swap limit support” is often encountered when using these commands

The general meaning is that the swap memory limit is not supported. Therefore, this warning is reported when testing on Tencent cloud and Alibaba cloud servers in China.

Limit the maximum memory usage of docker container

Parameter: – M 64M — memory swap = 128M

-M 64M limits the maximum physical memory that can be used by the container for operation to 64M, – memory swap = 128M limits the maximum virtual memory that can be used by the container to 128M. These two parameters are invalid when the warning: no swap limit support warning appears.

Solution:

1. Edit the/etc/default/grub file.

At grub_CMDLINE_Linux = “”, and add CGroup_enable=memory swapaccount=1

yang@master:~$ cat  /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity"
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"

Note: if grub_CMDLINE_Linux = content, remember not to delete, just add CGroup later_Enable = memory swapaccount = 1 and separate it from the previous content with a space.

2. Save, update

yang@master:~$  sudo update-grub

3. Restart the server

yang@master:~$ sudo reboot

4. Check

yang@master:~$ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
.....
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false