docker run -m指定內存大小不生效

執行docker run的時候,想要指定一下內存大小,用了-m參數,報錯如下
#docker run -id -m 3g -p 7001:7001 197.3.16.51/sysmgr/mywebapptest_app_weblogic:20180820047
WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
52380a4896f3f916cd0f95f97e233b30d9406840e10c0c53484b3be9000d0321
然後發現雖然我設置堆大小爲5G,容器還是創建出來了,3g的限制並沒有生效。

查閱資料發現這個報錯是因爲宿主機內核的相關功能沒有打開。按照下面的設置就行。

step 1:編輯/etc/default/grub文件,將GRUB_CMDLINE_LINUX一行改爲GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"

step 2:更新 GRUB,即執行$ sudo update-grub

step 3: 重啓系統。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章