Memory use in Docker Host

Hi everybody,

My name is Tony, and I am just diving into this new amazing world named Docker! I knew this tecnology a few years ago when I was studying at the University, but I’ve recently started to use it in production.

Good, I’ve got a server at home providing several microservices to my LAN network as well as WAN (for instance, Plex, Nextcloud, Gitlab and so on). From the beginning these microservices were running in KVM virtual machines with Debian Stretch, but now I’ve moved the most of these microservices into Docker containers. Of course I am incredibly happy with this change for several reasons, and everything is working pretty well. However, I’ve realized an issue I would like to ask you for.

All of my Docker containers now are running inside a KVM virtual machine, and this VM has about 30 GB of allocated memory and roughly 2 GB of swap. I’ve realized that it doesn’t matter how many Docker containers are running, the used memory of the VM doesn’t grow up more than roughly 10 GB. However, the VM is continuously swapping, like it hadn’t enough memory to work (and nevertheless it still has 20 GB of free memory).

I’m a bit concerned about this issue, because it seems it doesn’t matter the amount of resources I allocate to the VM.

The technical details are:

  • KVM host: Debian Stretch
  • Docker host (KVM VM): Debian Stretch
  • Docker version: 17.05.0-ce
  • 30 GB of RAM and 2 GB of swap
  • 31 containers running in the VM

Thanks in advance to everybody.

Tony.