Docker Container Memory Limit

Are there any default memory limits in Docker Windows containers with Docker Desktop for Windows ? I have an application that crashes when I run it in the container, but when I tried to specify the parameter --memory 2048mbfor the command, docker runit seems to work fine. At least in the scenario where he fell earlier. This gives me the impression that by default there is a memory limit, but I could not find it in the documentation. So my question is, is there a memory limit, and if so where is this documented?

+14
source share
7 answers

According to Docker reports for Windows Github ( https://github.com/moby/moby/issues/31604 ), when Docker for Windows runs on Windows 10, it actually uses the Hyper-V isolation model (and the process model is not available in the Win script 10).

And in this type of isolation, your container runs inside a lightweight virtual machine that has a default limit of 1 GB. Therefore, if you want to have more memory, you must use the -m option.

+16
source

Surprise! Surprise!

I have 32 GB of RAM on the host, but I see only 1 GB of RAM for Windows containers:

D:\>systeminfo | findstr "Memory"
Total Physical Memory:     1,023 MB
Available Physical Memory: 634 MB
Virtual Memory: Max Size:  1,023 MB
Virtual Memory: Available: 674 MB
Virtual Memory: In Use:    349 MB

D:\>wmic OS get FreePhysicalMemory /Value
FreePhysicalMemory=648340

D:\>wmic computersystem get TotalPhysicalMemory
TotalPhysicalMemory
1072742400

The same restriction on images made from:

  • Microsoft / windowsservercore
  • Microsoft / nanoserver

, Hyper-V --isolation=hyperv, - .

, , docker inspect.

+7

, , . , docker rm $(docker ps -a -q) .

0

.

0

, :

, . , hyper-v, 512 . "-m" . 2 gb .

, Windows. 1 , "-m". .

/ :

docker info -f "{{ .Isolation }}"

hyperv - hyper-v; - Windows

: , . .

0

Docker QuickStart Terminal

vm:

docker-machine rm default

vm : .

docker-machine create -d virtualbox --virtualbox-cpu-count=2 --virtualbox-memory=4096 --virtualbox-disk-size=50000 default

docker-machine stop
exit

Docker.

, , . , .

0

Linux

Windows 10 Docker Desktop --memory= --memory= --cpus=. :

  1. Docker ""
  2. "Advanced"
  3. Set how many processors and memory are available for containers here.

enter image description here

0
source

Source: https://habr.com/ru/post/1675001/


All Articles