我可以在docker-compose中使用mem_limit吗如何? [英] Can I use mem_limit in docker-compose? and How?
问题描述
我有一个以下 docker-compose.yml
< pre class =lang-yaml prettyprint-override>
repository:
image:myregistry / my_nginx_image
mem_limit:60m
卷:
- / etc /当地时间:/ etc / localtime
ports:
- 80:80
我如何证明容器实际上不超过60 MB的RAM?
我正在使用:
- docker 1.3.1
- docker-compose 1.1.0
是的。内存限制由docker-compose支持,值可以在您的示例中设置为m表示兆字节。
可以使用docker stats命令检查运行Docker容器的内存限制是多少。
如果您的容器名称为repository_1,请使用以下命令:
docker stats repository_1
其结果将与此相似:
CONTAINER CPU%MEM使用/限制MEM%NET I / O
/ pre>
repository_1 1.93%4.609 MiB / 60 MiB 7.20%1.832 KiB / 648 B
mem_limit is supported by docker-compose? How can I test it?
I have a following docker-compose.yml
repository: image: myregistry/my_nginx_image mem_limit: 60m volumes: - /etc/localtime:/etc/localtime ports: - "80:80"
How can I prove that the container actually does not exceed 60 mb of RAM?
I am using:
- docker 1.3.1
- docker-compose 1.1.0
Yes. Memory limitation is supported by docker-compose and value can be set as in your example with "m" for megabytes.
It is possible to check what is the memory limit set for running Docker container using "docker stats" command.
If your container name is "repository_1" then use this command:
docker stats repository_1
The result of this will be simillar to this one:
CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O
repository_1 1.93% 4.609 MiB/60 MiB 7.20% 1.832 KiB/648 B
这篇关于我可以在docker-compose中使用mem_limit吗如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!