-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Open
Labels
Description
This is the line I have after launching a sample docker stats
:
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
apache 0.54% 0 B / 4.158 GB 0.00% 14.36 MB / 14.89 MB 2.998 MB / 0 B
extranet 0.38% 0 B / 4.158 GB 0.00% 321.2 MB / 759.6 MB 10.26 MB / 0 B
postgres 0.00% 0 B / 4.158 GB 0.00% 406.3 MB / 197.1 MB 4.612 MB / 963.5 MB
docker version
and docker info
outputs are at the end of this report if needed. But before, let me add that:
- on same docker version (1.9.1) but different host, it works fine
- I have clear warning about no support of memory limit at the end of output of
docker info
. - I have ran check-config from https://github.com/docker/docker/raw/master/contrib/check-config.sh
and these are missing compared to the working host:
- CONFIG_MEMCG_KMEM: missing
- CONFIG_MEMCG_SWAP_ENABLED: missing
- CONFIG_CGROUP_HUGETLB: missing
- CONFIG_CFS_BANDWIDTH: missing
- CONFIG_RT_GROUP_SCHED: missing
I've removed other missing 'Optional features' that were explicitely not related (EXT3 feature for example).
One of these missing config value could be the culprit ? If yes, why is it dubbed optional ? can we have a clear warning when launching docker stats
then ?
Here are general information about the failing system:
$ uname -a
Linux CAR-PRD-21 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1 (2015-11-19) x86_64 GNU/Linux
$ cat /etc/debian_version
8.2
$ docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 12:59:02 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 12:59:02 UTC 2015
OS/Arch: linux/amd64
$ docker info
Containers: 8
Images: 134
Server Version: 1.9.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 150
Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
CPUs: 2
Total Memory: 3.873 GiB
Name: CAR-PRD-21
ID: C337:SIOE:AUZZ:AOPV:7BZ2:XS6O:UYJH:23TY:7M7R:LUZV:M5RO:6MRY
WARNING: No memory limit support
WARNING: No swap limit support
The system is running in VMWare (client and docker host).
Many thanks,
kukoman, Constantin07, u007, nielsole, Doom4535 and 6 more
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
thaJeztah commentedon Dec 4, 2015
Thanks for an excellent bug report, and doing the research!
Good question, I know memory-limit is affected by the availability of these options, but not sure if they (should) affect reading memory use here.
ping @crosbymichael perhaps you know if this is expected behavior if these options are missing, or is this a bug?
staff0rd commentedon Dec 9, 2015
I also get this issue, on my local debian box which currently runs docker 1.9.0. No problem on my Amazon Linux AMI instance (docker 1.8.2) which does not show the following
docker info
lines, while the debian one does;BrianAdams commentedon Jan 8, 2016
Same issue. I looked on the host and noted that the memory stats are not showing in /sys/fs/cgroup/memory.
Docker Info:
cpuguy83 commentedon Jan 8, 2016
Yes, it should effect reading memory usage since cgroup memory accounting is not going to work when missing.
Not sure what to do here as printing a warning isn't really going to work since the stats take up the screen... maybe instead of 0/0 we do something like
unsupported
BrianAdams commentedon Jan 8, 2016
In my case, there is a separate issue documenting the enabling of the memory controller for viewing memory stats: #251.
@cpuguy83 Documenting the zero stats may indicate that the proper cgroup manager is likely disabled, and how to manually verify via checking for the directory would be helpful. Probably here: https://docs.docker.com/engine/reference/commandline/stats/ or https://docs.docker.com/engine/articles/runmetrics/. While the article explains the connection to cgroups, it does not specify that docker will print zero if the statistic is not present.
staff0rd commentedon Jan 9, 2016
Excuse my ignorance, but is the lack of support due to software or hardware?
Perhaps the memory usage, and the memory % columns just not be present when they are unsupported considering that without support the values are inaccurate, and, the admin may have deliberately chosen not to support that feature for whatever reason.
murphyke commentedon Feb 18, 2016
In my situation,
docker stats
sometimes reports 0 memory usage for a container and sometimes not, even when the container's state is "not changing" (it is not being restarted or servicing any requests). I see this on Docker 1.8.2 and 1.9.1 on RHEL 7.2.If I do
while true; do docker stats --no-stream $(docker ps -q) | tail -n +2 | awk '{print $3}'; sleep 1; done
, I should see no zeroes, but sometimesstats
will return 0 for all the containers, sometimes for just a few, more often for none of the containers. There happen to be twenty-five containers running -- a couple PostgreSQL containers and the rest some custom web services.marc0der commentedon Mar 23, 2016
I have the same issue using Docker 1.10.3 on Debian 3.16.0-4-amd64 x86_64 GNU/Linux. I am also receiving a warning that my kernal does not have correct modules when I try setting memory limit for my containers.
Sturgelose commentedon Apr 2, 2016
@marc0der I have exactly the same problem with the same kernel and docker version.
In my case I'm running docker over a Xen VM, and I really thought it was that until I saw that all you have the same problem!
klokan commentedon Apr 5, 2016
It seems like everybody reporting the problem here has the default Debian Jessie install.
Possible fix: http://awhitehatter.me/debian-jessie-wdocker/
marc0der commentedon Apr 5, 2016
I tried it on my instance on Digital Ocean and it worked like a charm!
Thanks!
On Tue, 5 Apr 2016 at 17:39, Petr Pridal notifications@github.com wrote:
leshik commentedon Apr 13, 2016
I'm on Ubuntu 14.04 with 4.2.0-18-generic kernel and have mem/swap accounting enabled (docker info doesn't complain). Similar to @murphyke case some containers show statistics, some do not (zeroes only). Those that show have barely correct values, such as 1.5 or 2 Mb, some even few Kbs. I know for sure that it can't be true. What can I do to help troubleshoot this issue?
zelenin commentedon Apr 19, 2016
yes, it works for me too (Debian Jessie)
vaab commentedon Apr 20, 2016
@klokan Thanks, this fixes also the deal on my VMWare with debian Jessie.
TL;DR:
Your kernel is probably not configured not to have
cgroup
activated by default. To turn it on, you need a simple modification to theGRUB_CMDLINE_LINUX_DEFAULT
line in/etc/default/grub
with the following:GRUB_CMDLINE_LINUX_DEFAULT="quiet cgroup_enable=memory swapaccount=1"
Then run
sudo update-grub
and reboot.This should bring back memory stats.
More info: http://awhitehatter.me/debian-jessie-wdocker/
This should be definitively part of
check-config
script.thaJeztah commentedon Apr 20, 2016
@vaab are you interested in opening a PR to add that?
12 remaining items
singhsaumya commentedon Dec 9, 2020
Hi,
I followed the steps mentioned to resolve the issue but I still can't get the desired result. I followed the steps as here to install docker on Ubuntu 20.04 https://docs.docker.com/engine/install/ubuntu/
I didn't have the grub file present already in /etc/default, therefore I manually created one and added the line:
GRUB_CMDLINE_LINUX_DEFAULT="init=/bin/systemd console=hvc0 console=ttyS0 cgroup_enable=memory swapaccount=1"
Any idea on how to diagnose/fix this issue?
mvadu commentedon Feb 15, 2021
If anyone is looking for this issue on RaspberryPi OS, you will have to edit
/boot/cmdline.txt
and addcgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
to get the memory stats.Chinmaykd21 commentedon Apr 5, 2021
I am using Ubuntu 20.04(LTS) on Raspberry pi4. In my case, the 'cmdline.txt' file was present in '/boot/firmware/' folder. I followed the solution mentioned above and rebooted the pi. After that docker stats started showing the memory usage for the running containers.
TimorChow commentedon May 10, 2021
Thank you for sharing this. It works on Raspberry Pi 4
mind-overflow commentedon Aug 14, 2021
Hello, I'm having the same issue... But unfortunately, the
GRUB_CMDLINE_LINUX_DEFAULT
setting did not fix it. I am running on Ubuntu 20.04 server, not on raspberry pi. The flag is active, as shown bycat /proc/cmdline
:Does anyone have a suggestion? Maybe things have changed since 2016. Thanks!
darren-eggett-boseprofessional commentedon Sep 22, 2021
I'm also on a Raspberry Pi 4 and this did not solve the problem for me. 😢 I still show 0 memory usage and 0 memory limit for every container.
mvadu commentedon Sep 23, 2021
What OS are you running? My comment was specific to RaspberryPi OS.
darren-eggett-boseprofessional commentedon Sep 23, 2021
Found the problem -- an unintended line break that looked like a word-wrap in the cmdline.txt file. Got rid of the line break and all's working correctly.
felipe-negri commentedon Mar 29, 2022
i have the same error

docker stats:
docker version:
docker info
uname -r
5.17.1-051701-generic
GRUB File
/etc/default/grub
i think this happen after i upgrade the kernel version
Futuraura commentedon May 1, 2022
I have exactly the same symptoms and reconfiguring grub does not seems to help.
Maybe you can recommend some intermediate steps - like what to check and from where, were are my system information:
isaackogan commentedon Dec 16, 2022
Thank GOD for you. I have looked for hours.