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
Similar Posts:
- Record the problem that docker cannot be started once
- [Solved] MYSQL Error: [Warning] Changed limits: max_open_files: 1024
- [How to Solve] k8s pod erro exit code 137
- “Failed to get D-Bus connection” appears when docker runs the command
- [Solved] CDH6.3.2 Hive on spark Error: is running beyond physical memory limits
- [Solved] Failed to start Docker Application Container Engine.
- docker “mongo:systemctl start mongod.service” Error: mongod.service: New main PID 1390 does not belong to service, and PID file is not owned by root. Refusing.
- [Solved] Ubuntu gnome 17.04 error: kernel BUG at /build/linux-7LGLH_/linux-4.10.0/include/linux/swapops.h:129
- [Solved] Compile Error: virtual memory exhausted: Cannot allocate memory
- Alibaba cloud ECS installation cadvisor error [How to Solve]