docker stats shows zero memory usage even for running containers

Viewed 7042

I have two containers ran by Docker Swarm:

# docker ps
CONTAINER ID        IMAGE                               COMMAND                  CREATED             STATUS              PORTS               NAMES
18f1e7d79f5b        default/image1:latest               "/bin/sh -c 'java ..."   12 hours ago        Up 12 hours                             image1.1.x56zz152kmqtqpxzle5nkbs8r
11d1f05fcff1        default/image2:latest               "java -cp /app/sca..."   13 hours ago        Up 13 hours                             image2.1.ljztzeeh8i5r6ebr3n4hcj45e

$ docker stats --no-stream
CONTAINER           CPU %               MEM USAGE / LIMIT   MEM %               NET I/O             BLOCK I/O           PIDS
18f1e7d79f5b        0.92%               0B / 0B             0.00%               648B / 0B           0B / 0B             0
11d1f05fcff1        0.91%               0B / 0B             0.00%               39.9MB / 26.9MB     51.2MB / 0B         0

Host OS is Debian Jessie. There are JVM applications in both containers. Why does docker stats show zero memory usage? Should I configure my Java apps somehow to be able to see memory usage in docker stats? Is there some other way to check memory usage?

2 Answers

Ubuntu 20.04,

GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"

I had a same issue until I did not removed the oom-kill-disable from my yaml file.

        --memory=1500m \
   # --oom-kill-disable \
Related