Memory usage of Docker containers

后端 未结 3 2115
不知归路
不知归路 2021-02-12 01:31

I am using Docker to run some containerized apps. I am interested in measuring how much resources they consume (as far as regarding CPU and Memory usage).

Is there any w

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-12 02:01

    Also, you can read resource metrics directly from cgroups. See example below (I am running on Debian Jessie and docker 1.2)

    > docker ps -q
    afa03c363af5
    > ls /sys/fs/cgroup/memory/system.slice/ | grep docker-afa03c363af5
    docker-afa03c363af54815d721d938e01fe4cb2debc4f6c15ebff1851e20f6cde3ae0e.scope
    > cd docker-afa03c363af54815d721d938e01fe4cb2debc4f6c15ebff1851e20f6cde3ae0e.scope
    > cat memory.usage_in_bytes
    4358144
    > cat memory.limit_in_bytes
    1073741824
    

提交回复
热议问题