Docker服务禁用内存交换 [英] Docker service disable memory swap
问题描述
我可以为docker服务设置"MemorySwap"和"MemorySwappiness"吗?我想为docker容器(由docker服务启动)禁用内存交换,但我不想为主机禁用它.什么是"MemorySwappiness"中的-1值?
can i set "MemorySwap" and "MemorySwappiness" for docker service? I would like to disable memory swap for docker containers (started by docker service) but i don’t want to disable it for host machine. What means value of -1 at "MemorySwappiness"?
Docker版本:17.06.2-ce
Docker version: 17.06.2-ce
推荐答案
尽管这个问题很旧,但由于没有答案,我决定发布一个问题.
Although this question is old, as it has no answer I have decided to post one.
实际上,现在仅通过在创建容器时使用选项-memory-swap
即可支持禁用内存交换.根据
Indeed, disabling memory swap is now supported by just using the option --memory-swap
when creating the container. You simply have to set --memory
and --memory-swap
to the same value, according to the docs.
有关内存交换的更多信息,请访问此页面有关限制资源访问.
For more information about memory swapping, visit this page of the docs about constraining resource access.
这篇关于Docker服务禁用内存交换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!