Understanding docker resource limitations

elp asked:

I got the following ressource limits in my docker engine:

  • 4 CPUs
  • 4096 MB Memory
  • 2048 MB Swap
  • 64 GB Disk size

The docker container are running with default resource distribution. Now I was investigating the container ressource usage using docker stat. The output:

CONTAINER ID        NAME                                                        CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
df09b7636ef2        getstartedlab_articleservice.3.799hopivzdful5fkphy1l2skn    0.12%               204MiB / 913.3MiB     22.34%              69.9kB / 73kB       108MB / 12.3kB      32
afd5f157a3e2        getstartedlab_articleservice.1.r5v55711b3fr5q5h9ouu15quq    0.14%               93.56MiB / 913.3MiB   10.24%              104kB / 110kB       122MB / 0B          32
172b3fa09c46        getstartedlab_articleservice.2.pwrxsmnhc8hd1cmnhk9h4nv3e    0.15%               83.93MiB / 913.3MiB   9.19%               158kB / 167kB       183MB / 0B          32
e4199bfe7d92        getstartedlab_customerservice.1.a6xlzdol1dbnk2m481u393hzp   0.15%               71.56MiB / 913.3MiB   7.84%               176kB / 186kB       433MB / 0B          32
5e6d9eece953        getstartedlab_cartservice.1.iigrada1zp43sb8m2snyk9x4r       0.13%               75.66MiB / 913.3MiB   8.28%               180kB / 186kB       478MB / 57.3kB      30
46aff975d07d        getstartedlab_catalogservice.1.wewy4x5zpl23vhzi3r3cpzpi4    0.16%               61.93MiB / 913.3MiB   6.78%               179kB / 185kB       842MB / 111kB       30
41d7b9c2e502        getstartedlab_nginx-default.1.caco2pvdja514ymr3auu7nyq7     0.00%               1.184MiB / 913.3MiB   0.13%               43.7kB / 45.2kB     20MB / 0B           2

As you can see the memory limits on each container are totally equal. The limit is set to 913.3 MB. There are 7 containers in total.

7*913.3MB = 6393.1MB usage in total.

How does that make any sense? As mentioned above my max disk usage is set to 64GB (64000MB) and my RAM limit is set to 4096MB. What kind of memory is the MEM USAGE / LIMIT refering to?

My answer:


MEM USAGE refers to the actual amount of memory the container is using.

MEM LIMIT is the maximum amount of memory the container would be allowed to use. If the program in the container tried to use more than that, it would be refused.

MEM % is the percentage USAGE of the LIMIT.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.