简体   繁体   English

附加到Docker容器时的可用内存小于容器限制

[英]available memory when attached to docker container is less than container limit

when i start a container like this: 当我启动这样的容器时:

docker run -d --memory=6g $image , docker run -d --memory=6g $image

docker stats $container_id shows that it has a memory limit of 6gb, which is expected. docker stats $container_id显示其内存限制为6gb,这是预期的。

however, when i connect into that container ( docker exec -it $container_id /bin/bash ), my shell is limited to only 1gb. 但是,当我连接到该容器( docker exec -it $container_id /bin/bash )时,我的外壳程序仅限于1GB。 (which is confirmed by calling free -m as well as some testing in allocating objects in python [it fails at around 1gb]). (这可以通过调用free -m以及在python中分配对象的一些测试来证实[它在1gb左右失败])。

my question is: how can i get access to all of the memory available in the container? 我的问题是: 如何获取容器中可用的所有内存?

thank you. 谢谢。

ok, in this case, even though docker stats was showing that my container had 6gbs, the virtual machine on which docker was running was limited to 1gb. 好的,在这种情况下,即使docker docker stats显示我的容器有6gbs,运行docker的虚拟机也被限制为1gb。 so i changed my virtual machine limitations and solved the problem. 所以我更改了虚拟机限制并解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM