問題描述:
裝完docker後,用docker info ,顯示:WARNING: No swap limit support,這句話有什麼特別的意思嗎?若是是個人虛擬機配置問題,那又須要做哪些改動呢。linux
xkinght@xknight-optiplex-7040:~$ sudo docker info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 17.05.0-ce
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 0
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.13.0-43-generic
Operating System: Ubuntu 16.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.57GiB
Name: xknight-optiplex-7040
ID: AWE3:LSXJ:PENS:3QSC:D2BB:5UOL:E4NN:GEUQ:PWJQ:HG5P:25XN:WZAL
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: falsedocker
WARNING: No swap limit supportjson
問題解決:
根據錯誤提示,只是cgroups中的swap account沒有開啓。這個功能應該是用在 `docker run -m=1524288 -it ubuntu /bin/bash` 相似的命令,用來限制一個docker容器的內存使用上限,因此這裏只是WARNING,不影響使用。ubuntu
這個默認官方給予解決方法了,地址是https://docs.docker.com/installation/ubuntulinux/bash
1 When users run Docker, they may see these messages when working with an image: 2 WARNING: Your kernel does not support cgroup swap limit. WARNING: Your 3 kernel does not support swap limit capabilities. Limitation discarded. 4 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. 5 Log into Ubuntu as a user with sudo privileges. 6 Edit the /etc/default/grub file. 7 Set the GRUB_CMDLINE_LINUX value as follows: 8 GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1" 9 Save and close the file. 10 Update GRUB. 11 $ sudo update-grub 12 Reboot your system.