2

I'm running docker on a windows machine with 16GB RAM. My container uses 4GB of memory as per docker stats(see output below). However, there is no process as per my windows task manager taking that kind of memory, and the memory usage on my computer does not change when i start/stop my container.

Thus my questions are

  1. From where the 4GB of RAM used by container is coming from (disk as RAM?)
  2. How can i configure my container to use the available RAM

My container is extremely slow and I suspect its because of the above behavior; where it is using disk as virtual memory and thus not really using the resources(RAM) available to it.

$ docker stats

CONTAINER ID        NAME                CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
66a9ccfd0a51        quirky_wozniak      0.04%               4.268GiB / 4.815GiB   88.63%              113kB / 20.2kB      40.8MB / 1.07MB     16

task manager screen shot

Docker Settings

2 Answers 2

0

Docker for Windows typically runs a VM to support Linux containers. The memory given to this VM is the memory available on the docker host. In the preferences, there is a menu to configure the number of CPU cores and amount of memory to dedicate to this VM:

Advance VM settings

(Image credit: Docker for Windows documentation)

7
  • in Advanced VM Settings i have given 5GB of RAM and 4GB of Swap. Still the container is not using the host's RAM. to avoid ambiguity, i'm adding a screenshot of my Advanced VM settings as well
    – Mangalraj
    May 7, 2019 at 19:46
  • 5GB = 4.815 GiB roughly. It's a slight difference in units (binary vs 10's): en.wikipedia.org/wiki/Gibibyte
    – BMitch
    May 7, 2019 at 20:21
  • Note the limit shown in docker stats doesn't factor in other processes running inside the VM on the docker host, so the container is unable to use all of that memory. Docker is just letting you know that without a limit defined, the container is allowed to use all of the host memory it can get.
    – BMitch
    May 7, 2019 at 20:26
  • If i have set a limit of 5GB for my docker VM, and if i have a process which takes 4GB running inside my container, bare minimum i expect 4GB of memory of my docker host being used. My question is why we are not using that.
    – Mangalraj
    May 7, 2019 at 20:38
  • Docker runs in HyperV, not sure task manager has any visibility to VM's, it's showing you the processes running inside your current windows instance. My question is why haven't you tried adjusting the slider to give docker more memory already? I'll consider answering further comments after you make this change and show that it had no improvement for you.
    – BMitch
    May 7, 2019 at 20:44
0

The issue is that Task Manager doesn't consider Hyper-V as a process and thus is not displayed among the list of processes. In other words, the memory being consumed by was not displayed by task manager anwywere other than in summary.

By using advanced tools like RMAP we can see that memory is being used under "Driver Locked" section.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.