Get cpu usage from Java API 1.13 for docker 1.1.2

I am trying to obtain the amount of cpu (measured in time or percentage, any one) utilized by a specific container deployed using docker as:

docker run <container_name>

or using lxc as:

  • Reuse host binaries or share between containers in Docker
  • Configure docker daemon logs
  • docker cp the content of a folder
  • How to get a Docker container's IP address from the host?
  • How to deploy docker file on other server
  • Error: “error creating aufs mount to” when building dockerfile
  • lxc-start -n <container_name>

    I see that the container deployed using lxc has cpu usage statistics stored in /sys/fs/cgroup/cpuacct/cpuacct.stat

    However, I want to obtain these stats using the java API that can be obtained from here:

    I see that the API provides methods to start, stop containers, image information, etc. However, I don’t see a way that can provide container statistics such as cpu, memory and other resource usage statistics. From this question I see that this should have been present in API 1.0.

    How do I get the cpu, memory, network and other resource usage statistics from the java API?

    I would also very much appreciate an online blog or tutorial that can provide more insights into this too.



    Client version: 1.1.2
    Client API version: 1.13
    Go version (client): go1.2.1
    Git commit (client): d84a070
    Server version: 1.1.2
    Server API version: 1.13
    Go version (server): go1.2.1
    Git commit (server): d84a070

    Host OS:

    • Ubuntu 14.04 Trusty Tahr LTS
    • Java 1.7

  • Docker-machine ip in Dockerfile
  • Docker expose link to host machine
  • How to stop/relaunch docker container without losing the changes?
  • how to find MAX memory from docker stats?
  • Issue with Jenkins pipeline script and docker maven image
  • Why docker showing localhost data?
  • 2 Solutions collect form web for “Get cpu usage from Java API 1.13 for docker 1.1.2”

    If you are still interested, the latest version of cadvisor ( added support for networking, filesystem, and many other stats. Give it another try.

    You can use this API to monitor cpu and memory usage :

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.