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:

  • Change ulimit in Docker Container
  • Docker /dev/mapper permission
  • How to send logs from tomcat docker container to catalina.out?
  • Building a Docker Image with rstan on rocker/verse
  • Cloudbees Docker Plugin - “?” Folder
  • docker-compose for Detached mode
  • 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?

  • has the linux kernel support sctp protocol in container of LXC/docker yet?
  • Docker volumes doesn't exist for data container in 1.9.1
  • Docker named volume not updating
  • Docker Compose Links not working with Host mode
  • Issue with running RabbitMQ in Python using Pika inside Docker container
  • how to mount localhost volume to a docker container using docker-compose
  • 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.