Does docker windows containers have default memory limit?
I have an application that was crashing when I run it in the container, but when I tried to specify --memory 2048mb
parameter to the docker run
command it seems to run fine. At least in the scenario where it was crashing before. This gives me impression that there is default memory limit, but I could not find it in the documentation. So my question is there memory limit and if it is where it is documented?
相关问题
- Docker task in Azure devops won't accept "$(pw
- Unable to run mariadb when mount volume
- Unspecified error (0x80004005) while running a Doc
- What would prevent code running in a Docker contai
- How to reload apache in php-apache docker containe
No default limits. Documented here
We recently had a very similar problem and question and therefore made some experiments with docker memory on windows:
It seems that it heavily depends on you configuration. If you run docker containers in, lets call it hyper-v mode, the memory limit seems to be about 512mb. You can extend the given memory with the "-m" option for docker run. Assigning 2 gb have not been a problem.
Unfortunately, its totally different for windows server containers. There the starting memory limit is 1gb and you can decrease it with the "-m" option. We did not find a way to increase the memory for those containers.
How you see your mode/isolation level:
hyperv - hyper-v mode; process is windows server
Some additional notes: Its very hard to find a command that outputs the available memory in a container. We had created our own performance test for reliable results.
According to talks on Docker for windows Github issues (https://github.com/moby/moby/issues/31604), when Docker for Windows is run under Windows 10, it is actually using a Hyper-V isolation model (and process model is not accessible in Win 10 scenario).
And in that isolation type, your container is run inside a lightweight VM, which DOES have a default limit, and it is 1 Gb. So if you want to have more memory you should use -m param.
I think it might be that you have too much dead containers. Maybe try
docker rm $(docker ps -a -q)
to remove all the exited container then retry running the container you want.Surprise! Surprise!
I have 32Gb RAM on my host but I can see only 1Gb RAM given to Windows containers:
The same limit on images made from:
I think it's coming from the Hyper-V layer in
--isolation=hyperv
mode, where a container is some sort of lightweight VM.You can check isolation mode used for your existing container by
docker inspect
command.