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.
1. Edit the/etc/default/grub file.
At grub_CMDLINE_Linux = “”, and add CGroup_enable=memory swapaccount=1
[email protected]:~$ 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
[email protected]:~$ sudo update-grub
3. Restart the server
[email protected]:~$ sudo reboot
[email protected]:~$ docker info Client: Context: default Debug Mode: false Plugins: ..... Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false
- Record the problem that docker cannot be started once
- [How to Solve] k8s pod erro exit code 137
- “Failed to get D-Bus connection” appears when docker runs the command
- [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]
- How to Solve docker run Error: oci runtime error
- [Solved] Docker error: Error starting daemon: Error initializing network controller: list bridge addresses failed: no available network