Memory usage of Docker containers
You can get this from docker stats
e.g:
$ docker stats --no-streamCONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS6b5c0fcfa7d4 0.13% 2.203 MiB / 4 MiB 55.08% 5.223 kB / 648 B 102.4 kB / 876.5 kB 3
Update: See @Adrian Mouat's answer below as docker now supports docker stats
!
There isn't a way to do this that's built into docker in the current version. Future versions will support this via an api or plugin.
It does look like there's an lxc project that you should be able to use to track CPU and Memory.
Also, you can read resource metrics directly from cgroups.See example below (I am running on Debian Jessie
and docker 1.2
)
> docker ps -qafa03c363af5> ls /sys/fs/cgroup/memory/system.slice/ | grep docker-afa03c363af5docker-afa03c363af54815d721d938e01fe4cb2debc4f6c15ebff1851e20f6cde3ae0e.scope> cd docker-afa03c363af54815d721d938e01fe4cb2debc4f6c15ebff1851e20f6cde3ae0e.scope> cat memory.usage_in_bytes4358144> cat memory.limit_in_bytes1073741824