Docker Engine API
  1. Container
Docker Engine API
  • System
    • Ping
      GET
    • Check auth configuration
      POST
    • Monitor events
      GET
    • Get system information
      GET
    • Get data usage information
      GET
    • Get version
      GET
  • Image
    • Build an image
    • Delete builder cache
    • Create a new image from a container
    • Create an image
    • Export several images
    • List Images
    • Import images
    • Delete unused images
    • Search images
    • Remove an image
    • Export an image
    • Get the history of an image
    • Inspect an image
    • Push an image
    • Tag an image
  • Config
    • List configs
    • Create a config
    • Delete a config
    • Inspect a config
    • Update a Config
  • Container
    • Create a container
      POST
    • List containers
      GET
    • Delete stopped containers
      POST
    • Remove a container
      DELETE
    • Get an archive of a filesystem resource in a container
      GET
    • Get information about files in a container
      HEAD
    • Extract an archive of files or folders to a directory in a container
      PUT
    • Attach to a container
      POST
    • Attach to a container via a websocket
      GET
    • Get changes on a container’s filesystem
      GET
    • Export a container
      GET
    • Inspect a container
      GET
    • Kill a container
      POST
    • Get container logs
      GET
    • Pause a container
      POST
    • Rename a container
      POST
    • Resize a container TTY
      POST
    • Restart a container
      POST
    • Start a container
      POST
    • Get container stats based on resource usage
      GET
    • Stop a container
      POST
    • List processes running inside a container
      GET
    • Unpause a container
      POST
    • Update a container
      POST
    • Wait for a container
      POST
  • Exec
    • Create an exec instance
    • Inspect an exec instance
    • Resize an exec instance
    • Start an exec instance
  • Distribution
    • Get image information from the registry
  • Network
    • List networks
    • Create a network
    • Delete unused networks
    • Remove a network
    • Inspect a network
    • Connect a container to a network
    • Disconnect a container from a network
  • Node
    • List nodes
    • Delete a node
    • Inspect a node
    • Update a node
  • Plugin
    • List plugins
    • Create a plugin
    • Get plugin privileges
    • Install a plugin
    • Remove a plugin
    • Disable a plugin
    • Enable a plugin
    • Inspect a plugin
    • Push a plugin
    • Configure a plugin
    • Upgrade a plugin
  • Secret
    • List secrets
    • Create a secret
    • Delete a secret
    • Inspect a secret
    • Update a Secret
  • Service
    • List services
    • Create a service
    • Delete a service
    • Inspect a service
    • Get service logs
    • Update a service
  • Session (experimental)
    • Initialize interactive session
  • Swarm
    • Inspect swarm
    • Initialize a new swarm
    • Join an existing swarm
    • Leave a swarm
    • Unlock a locked manager
    • Get the unlock key
    • Update a swarm
  • Task
    • List tasks
    • Inspect a task
  • Volume
    • List volumes
    • Create a volume
    • Delete unused volumes
    • Remove a volume
    • Inspect a volume
  • Get task logs
    GET
  1. Container

Get container stats based on resource usage

/v1.33
/v1.33
/v1.33
/v1.33
GET
/containers/{id}/stats
This endpoint returns a live stream of a container’s resource usage
statistics.
The precpu_stats is the CPU statistic of last read, which is used
for calculating the CPU usage percentage. It is not the same as the
cpu_stats field.
If either precpu_stats.online_cpus or cpu_stats.online_cpus is
nil then for compatibility with older daemons the length of the
corresponding cpu_usage.percpu_usage array should be used.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request GET '/v1.33/containers//stats'
Response Response Example
200 - response
{
    "blkio_stats": {},
    "cpu_stats": {
        "cpu_usage": {
            "percpu_usage": [
                8646879,
                24472255,
                36438778,
                30657443
            ],
            "total_usage": 100215355,
            "usage_in_kernelmode": 30000000,
            "usage_in_usermode": 50000000
        },
        "online_cpus": 4,
        "system_cpu_usage": 739306590000000,
        "throttling_data": {
            "periods": 0,
            "throttled_periods": 0,
            "throttled_time": 0
        }
    },
    "memory_stats": {
        "failcnt": 0,
        "limit": 67108864,
        "max_usage": 6651904,
        "stats": {
            "active_anon": 6537216,
            "active_file": 0,
            "cache": 0,
            "hierarchical_memory_limit": 67108864,
            "inactive_anon": 0,
            "inactive_file": 0,
            "mapped_file": 0,
            "pgfault": 964,
            "pgmajfault": 0,
            "pgpgin": 477,
            "pgpgout": 414,
            "rss": 6537216,
            "rss_huge": 6291456,
            "total_active_anon": 6537216,
            "total_active_file": 0,
            "total_cache": 0,
            "total_inactive_anon": 0,
            "total_inactive_file": 0,
            "total_mapped_file": 0,
            "total_pgfault": 964,
            "total_pgmajfault": 0,
            "total_pgpgin": 477,
            "total_pgpgout": 414,
            "total_rss": 6537216,
            "total_rss_huge": 6291456,
            "total_unevictable": 0,
            "total_writeback": 0,
            "unevictable": 0,
            "writeback": 0
        },
        "usage": 6537216
    },
    "networks": {
        "eth0": {
            "rx_bytes": 5338,
            "rx_dropped": 0,
            "rx_errors": 0,
            "rx_packets": 36,
            "tx_bytes": 648,
            "tx_dropped": 0,
            "tx_errors": 0,
            "tx_packets": 8
        },
        "eth5": {
            "rx_bytes": 4641,
            "rx_dropped": 0,
            "rx_errors": 0,
            "rx_packets": 26,
            "tx_bytes": 690,
            "tx_dropped": 0,
            "tx_errors": 0,
            "tx_packets": 9
        }
    },
    "pids_stats": {
        "current": 3
    },
    "precpu_stats": {
        "cpu_usage": {
            "percpu_usage": [
                8646879,
                24350896,
                36438778,
                30657443
            ],
            "total_usage": 100093996,
            "usage_in_kernelmode": 30000000,
            "usage_in_usermode": 50000000
        },
        "online_cpus": 4,
        "system_cpu_usage": 9492140000000,
        "throttling_data": {
            "periods": 0,
            "throttled_periods": 0,
            "throttled_time": 0
        }
    },
    "read": "2015-01-08T22:57:31.547920715Z"
}

Request

Path Params

Query Params

Responses

🟢200no error
application/json
Body

🟠404no such container
🔴500server error
Modified at 2022-09-10 17:56:06
Previous
Start a container
Next
Stop a container
Built with