简体   繁体   English

如何为Docker容器分配更多内存?

[英]How to allocate more memory for docker container?

I have python flask app which loads to memory large file (3.5 GB). 我有python flask应用程序,可加载到内存大文件(3.5 GB)。 When I run that app in docker, it doesn't respond to requests, but container somehow works. 当我在docker中运行该应用程序时,它不响应请求,但是容器以某种方式起作用。 When I try to run my app without loading that large file to memory it respons to requests. 当我尝试运行我的应用程序而不将大文件加载到内存时,它会响应请求。

By default docker does not restrict memory usage by containers. 默认情况下,docker不限制容器的内存使用情况。 However, on Mac and Windows installs, Docker runs in a VM and that VM is limited in how much memory it takes from your OS. 但是,在Mac和Windows安装上,Docker在VM中运行,并且该VM限制了它从OS占用的内存量。 You can adjust this setting in the Docker preferences for Mac and Windows. 您可以在Mac和Windows的Docker首选项中调整此设置。

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

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