简体   繁体   English

如何让 Jupyter Docker 容器使用更多内存

[英]How to make a Jupyter Docker container use more memory

I'm running a jupyter/scipy-notebook Docker container.我正在运行一个jupyter/scipy-notebook Docker 容器。 I have not restricted the memory assigned to the container with the run command.我没有使用 run 命令限制分配给容器的内存。

However, what I'm seeing issuing the docker stats command is that the container is limiting its memory usage to 2 GB (on 16 GB available!), even if doing complex calculations.但是,我看到发出docker stats命令是容器将其内存使用限制为 2 GB(16 GB 可用!),即使进行复杂的计算。

How is this possible?这怎么可能?

I am running Docker on Mac OS and Jupyter crashed when trying to read over 600MB CSV file.我在 Mac OS 上运行 Docker,当尝试读取超过 600MB 的 CSV 文件时,Jupyter 崩溃了。 Following Andris Birkmanis instructions helped to tackle the issue by increasing the size of allocated memory for Docker.按照 Andris Birkmanis 的说明通过增加为 Docker 分配的内存大小帮助解决了这个问题。

Alter the resources (RAM) settings from Docker Desktop - MAC/Windows.从 Docker Desktop - MAC/Windows 更改资源 (RAM) 设置。

MAC - Docker Desktop MAC - Docker 桌面

Preferences --> Advanced --> Change Ram Settings

Windows - Docker Desktop Windows - Docker 桌面

Settings --> Resources --> Change the CPU / RAM / SWAP Settings

在此处输入图片说明

Reference: Compiled the solution from @samirko and @Andris Birkmanis.参考:从@samirko 和@Andris Birkmanis 编译解决方案。 (Added Windows Solution) (添加了 Windows 解决方案)

If everything is going well, by default, docker shouldn't limit by default memory usage at all.如果一切顺利,默认情况下,docker 根本不应该限制默认内存使用。 So, your MEM USAGE / LIMIT doing docker stats [containerid] should be the same than your total memory (16Gb in your case), although it's not free but available.因此,您执行docker stats [containerid]MEM USAGE / LIMIT应该与您的总内存(在您的情况下为 16Gb)相同,尽管它不是免费的但可用。

Furthermore, there's no way to set by default a docker memory limit invoking dockerd ,此外,默认情况下无法设置调用dockerd内存限制,

So, the only thing I can purpose is specify memory limit in docker run所以,我唯一能做的就是在docker run指定内存限制

  • -m, --memory="" Memory limit (format: <number>[<unit>]). Number is a positive integer. Unit can be one of b, k, m, or g. Minimum is 4M.
  • --memory-swap="" Total memory limit (memory + swap, format: <number>[<unit>]). Number is a positive integer. Unit can be one of b, k, m, or g.
  • --memory-reservation="" Memory soft limit (format: <number>[<unit>]). Number is a positive integer. Unit can be one of b, k, m, or g.
  • --kernel-memory="" Kernel memory limit (format: <number>[<unit>]). Number is a positive integer. Unit can be one of b, k, m, or g. Minimum is 4M.

For more information, please check Docker documentation run-time options有关更多信息,请查看Docker 文档运行时选项

Check your docker run --memory-reservation=10g ... and let's see.检查您的docker run --memory-reservation=10g ...让我们看看。

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

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