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 to configure `ng serve` to catch changes in a dockersized Angular 2 app?
  • Run Elasticsearch, Logstash and Kibana with 'docker-compose' command
  • Docker machine / Docker link returns different container IP on Digital Ocean
  • Docker Fluentd Logging Driver For multiline
  • Can we deploy an mvc 4 app to docker with windows container?
  • Using 'pyenv activate' in a Dockerfile
  • 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?

  • Loss IIS execution when enable docker support
  • Can travis-ci run docker?
  • Add host mapping to /etc/hosts in Kubernetes
  • Is it safe to extract the root filesystem of a image and use it in a chroot?
  • 5 - Docker
  • Copy files to docker image after build
  • 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<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.