espogian
espogian

Reputation: 607

How to make a Jupyter Docker container use more memory

I'm running a jupyter/scipy-notebook Docker container. I have not restricted the memory assigned to the container with the run command.

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.

How is this possible?

Upvotes: 4

Views: 3144

Answers (3)

jona
jona

Reputation: 702

Alter the resources (RAM) settings from Docker Desktop - MAC/Windows.

MAC - Docker Desktop

Preferences --> Advanced --> Change Ram Settings

Windows - Docker Desktop

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

enter image description here

Reference: Compiled the solution from @samirko and @Andris Birkmanis. (Added Windows Solution)

Upvotes: 4

samirko
samirko

Reputation: 21

I am running Docker on Mac OS and Jupyter crashed when trying to read over 600MB CSV file. Following Andris Birkmanis instructions helped to tackle the issue by increasing the size of allocated memory for Docker.

Upvotes: 2

Alejandro Galera
Alejandro Galera

Reputation: 3691

If everything is going well, by default, docker shouldn't limit by default memory usage at all. 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.

Furthermore, there's no way to set by default a docker memory limit invoking dockerd,

So, the only thing I can purpose is specify memory limit in 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

Check your docker run --memory-reservation=10g ...and let's see.

Upvotes: 0

Related Questions