限制docker-compose v3中的资源 [英] Limit resources in docker-compose v3
问题描述
mem_limit。该文档告诉我,我应该改用 deploy.resources
键,而且该部分仅对swarm或docker stack有效。
mem_limit is no longer supported in version 3 of docker-compose.yml file. The documentation tells that I should use the deploy.resources
key instead but also that this part will only be effective with swarm or docker stack.
cpu_shares,cpu_quota,cpuset,mem_limit,memswap_limit:这些已被部署中的资源密钥替换。请注意,部署配置仅在使用docker stack deploy时生效,而被docker-compose忽略。
cpu_shares, cpu_quota, cpuset, mem_limit, memswap_limit: These have been replaced by the resources key under deploy. Note that deploy configuration only takes effect when using docker stack deploy, and is ignored by docker-compose.
... 在文档中编写。
如何使用docker-compose和yml文件的v3格式设置内存/ cpu限制?
How do I set memory/cpu limits with docker-compose with v3 format of the yml file?
推荐答案
我想知道同一件事,发现了这一点:$ b $ b https ://github.com/docker/compose/issues/4513
I was wondering the same thing and found this: https://github.com/docker/compose/issues/4513
因此,简而言之,这是不可能的,您必须使用该版本docker-compose格式的2.1可以指定 docker-compose up
So in short it's just not possible to do that, you have to use the version 2.1 of the docker-compose format to be able to specify limits that are not ignored by docker-compose up
这篇关于限制docker-compose v3中的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!