Cannot retrieve the stats of my docker containers using Docker APIs

I have several containers that are running on my Centos7 VM and I would like to retrieve their CPU and Memory usage using the following command:

echo -e "GET /containers/(container_name)/stats HTTP/1.0\r\n" | \
  nc -U /var/run/docker.sock

However, I just receive the following message without any statistics:

  • How does one get docker running on Ubuntu 16 and remove old installs?
  • Azure ip address refused for docker
  • Docker Compose (docker-compose) couldn't connect to docker daemon on Windows Server 2016 TP5
  • Difference between Rancher and other container orchestration
  • docker image - centos 7 > ssh service not found
  • How to manage docker image dependencies (maintainance)
  • HTTP/1.0 200 OK

    Server: Docker/1.10.3 (linux)

    Date: Sun, 22 Jan 2017 15:53:49 GMT

    Content-Type: text/plain; charset=utf-8

    The “containers/(container_name)/top” command works fine.

    Can you please help me to understand why I don’t receive this container’s statistics?

  • Docker flask cant connect
  • How can I numactl membind a process inside Docker container?
  • Docker Cloud Automated builds
  • Debug python application running in Docker
  • Jenkins: a heavily branched chain of build jobs
  • Can Docker application container run without OS
  • One Solution collect form web for “Cannot retrieve the stats of my docker containers using Docker APIs”

    Command to use get the stats of the container:

    curl -X GET http://127.0.0.1:6000/containers/<container_id>/stats
    

    The stats will be displayed for every second.

    Stats can be fetched only for running containers.

    Refer this :

    how to configure docker daemon port.

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