---
title: "GET /containers/{id}/stats"
method: GET
path: "/containers/{id}/stats"
---

# GET /containers/{id}/stats

`GET /containers/{id}/stats`

Get container stats based on resource usage

## Path parameters

- `id` string, required

## Query parameters

- `stream` boolean
- `one-shot` boolean

## Response `200`

The request has succeeded.

- ContainerStatsResponse — Statistics sample for a container.
  - `id` string, nullable — ID of the container for which the stats were collected.
  - `name` string, nullable — Name of the container for which the stats were collected.
  - `os_type` string, nullable — OSType is the OS of the container ("linux" or "windows") to allow platform-specific handling of stats.
  - `read` string, date-time — Date and time at which this sample was collected. The value is formatted as [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) with nano-seconds.
  - `cpu_stats` ContainerCPUStats — CPU related info of the container
    - `cpu_usage` ContainerCPUUsage — All CPU stats aggregated since container inception.
      - `total_usage` integer — Total CPU time consumed in nanoseconds (Linux) or 100's of nanoseconds (Windows).
      - `percpu_usage` integer[], nullable — Total CPU time (in nanoseconds) consumed per core (Linux). This field is Linux-specific when using cgroups v1. It is omitted when using cgroups v2 and Windows containers.
      - `usage_in_kernelmode` integer — Time (in nanoseconds) spent by tasks of the cgroup in kernel mode (Linux), or time spent (in 100's of nanoseconds) by all container processes in kernel mode (Windows). Not populated for Windows containers using Hyper-V isolation.
      - `usage_in_usermode` integer — Time (in nanoseconds) spent by tasks of the cgroup in user mode (Linux), or time spent (in 100's of nanoseconds) by all container processes in kernel mode (Windows). Not populated for Windows containers using Hyper-V isolation.
    - `system_cpu_usage` integer, nullable — System Usage. This field is Linux-specific and omitted for Windows containers.
    - `online_cpus` integer, nullable — Number of online CPUs. This field is Linux-specific and omitted for Windows containers.
    - `throttling_data` ContainerThrottlingData — CPU throttling stats of the container. This type is Linux-specific and omitted for Windows containers.
      - `periods` integer — Number of periods with throttling active.
      - `throttled_periods` integer — Number of periods when the container hit its throttling limit.
      - `throttled_time` integer — Aggregated time (in nanoseconds) the container was throttled for.
  - `memory_stats` ContainerMemoryStats — Aggregates all memory stats since container inception on Linux. Windows returns stats for commit and private working set only.
    - `usage` integer, nullable — Current `res_counter` usage for memory. This field is Linux-specific and omitted for Windows containers.
    - `max_usage` integer, nullable — Maximum usage ever recorded. This field is Linux-specific and only supported on cgroups v1. It is omitted when using cgroups v2 and for Windows containers.
    - `stats` object — All the stats exported via memory.stat. The fields in this object differ between cgroups v1 and v2. On cgroups v1, fields such as `cache`, `rss`, `mapped_file` are available. On cgroups v2, fields such as `file`, `anon`, `inactive_file` are available. This field is Linux-specific and omitted for Windows containers.
    - `failcnt` integer, nullable — Number of times memory usage hits limits. This field is Linux-specific and only supported on cgroups v1. It is omitted when using cgroups v2 and for Windows containers.
    - `limit` integer, nullable — This field is Linux-specific and omitted for Windows containers.
    - `commitbytes` integer, nullable — Committed bytes. This field is Windows-specific and omitted for Linux containers.
    - `commitpeakbytes` integer, nullable — Peak committed bytes. This field is Windows-specific and omitted for Linux containers.
    - `privateworkingset` integer, nullable — Private working set. This field is Windows-specific and omitted for Linux containers.
  - `networks` object, nullable — Network statistics for the container per interface. This field is omitted if the container has no networking enabled.
  - `pids_stats` ContainerPidsStats — PidsStats contains Linux-specific stats of a container's process-IDs (PIDs). This type is Linux-specific and omitted for Windows containers.
    - `current` integer, nullable — Current is the number of PIDs in the cgroup.
    - `limit` integer, nullable — Limit is the hard limit on the number of pids in the cgroup. A "Limit" of 0 means that there is no limit.
  - `blkio_stats` ContainerBlkioStats — BlkioStats stores all IO service stats for data read and write. This type is Linux-specific and holds many fields that are specific to cgroups v1. On a cgroup v2 host, all fields other than `io_service_bytes_recursive` are omitted or `null`. This type is only populated on Linux and omitted for Windows containers.
    - `io_service_bytes_recursive` ContainerBlkioStatEntry[]
      - `major` integer
      - `minor` integer
      - `op` string
      - `value` integer
    - `io_serviced_recursive` ContainerBlkioStatEntry[], nullable — This field is only available when using Linux containers with cgroups v1. It is omitted or `null` when using cgroups v2.
      - `major` integer
      - `minor` integer
      - `op` string
      - `value` integer
    - `io_queue_recursive` ContainerBlkioStatEntry[], nullable — This field is only available when using Linux containers with cgroups v1. It is omitted or `null` when using cgroups v2.
      - `major` integer
      - `minor` integer
      - `op` string
      - `value` integer
    - `io_service_time_recursive` ContainerBlkioStatEntry[], nullable — This field is only available when using Linux containers with cgroups v1. It is omitted or `null` when using cgroups v2.
      - `major` integer
      - `minor` integer
      - `op` string
      - `value` integer
    - `io_wait_time_recursive` ContainerBlkioStatEntry[], nullable — This field is only available when using Linux containers with cgroups v1. It is omitted or `null` when using cgroups v2.
      - `major` integer
      - `minor` integer
      - `op` string
      - `value` integer
    - `io_merged_recursive` ContainerBlkioStatEntry[], nullable — This field is only available when using Linux containers with cgroups v1. It is omitted or `null` when using cgroups v2.
      - `major` integer
      - `minor` integer
      - `op` string
      - `value` integer
    - `io_time_recursive` ContainerBlkioStatEntry[], nullable — This field is only available when using Linux containers with cgroups v1. It is omitted or `null` when using cgroups v2.
      - `major` integer
      - `minor` integer
      - `op` string
      - `value` integer
    - `sectors_recursive` ContainerBlkioStatEntry[], nullable — This field is only available when using Linux containers with cgroups v1. It is omitted or `null` when using cgroups v2.
      - `major` integer
      - `minor` integer
      - `op` string
      - `value` integer
  - `num_procs` integer — The number of processors on the system. This field is Windows-specific and always zero for Linux containers.
  - `storage_stats` ContainerStorageStats — StorageStats is the disk I/O stats for read/write on Windows. This type is Windows-specific and omitted for Linux containers.
    - `read_count_normalized` integer, nullable
    - `read_size_bytes` integer, nullable
    - `write_count_normalized` integer, nullable
    - `write_size_bytes` integer, nullable
  - `preread` string, date-time — Date and time at which this first sample was collected. This field is not propagated if the "one-shot" option is set. If the "one-shot" option is set, this field may be omitted, empty, or set to a default date (`0001-01-01T00:00:00Z`). The value is formatted as [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) with nano-seconds.
  - `precpu_stats` ContainerCPUStats — CPU related info of the container
    - `cpu_usage` ContainerCPUUsage — All CPU stats aggregated since container inception.
      - `total_usage` integer — Total CPU time consumed in nanoseconds (Linux) or 100's of nanoseconds (Windows).
      - `percpu_usage` integer[], nullable — Total CPU time (in nanoseconds) consumed per core (Linux). This field is Linux-specific when using cgroups v1. It is omitted when using cgroups v2 and Windows containers.
      - `usage_in_kernelmode` integer — Time (in nanoseconds) spent by tasks of the cgroup in kernel mode (Linux), or time spent (in 100's of nanoseconds) by all container processes in kernel mode (Windows). Not populated for Windows containers using Hyper-V isolation.
      - `usage_in_usermode` integer — Time (in nanoseconds) spent by tasks of the cgroup in user mode (Linux), or time spent (in 100's of nanoseconds) by all container processes in kernel mode (Windows). Not populated for Windows containers using Hyper-V isolation.
    - `system_cpu_usage` integer, nullable — System Usage. This field is Linux-specific and omitted for Windows containers.
    - `online_cpus` integer, nullable — Number of online CPUs. This field is Linux-specific and omitted for Windows containers.
    - `throttling_data` ContainerThrottlingData — CPU throttling stats of the container. This type is Linux-specific and omitted for Windows containers.
      - `periods` integer — Number of periods with throttling active.
      - `throttled_periods` integer — Number of periods when the container hit its throttling limit.
      - `throttled_time` integer — Aggregated time (in nanoseconds) the container was throttled for.

---

[API](https://skmtc.net/hexlet/apis/docker-engine-api.md) · [All operations](https://skmtc.net/hexlet/apis/docker-engine-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hexlet/docker-engine-api/versions/7dbd508c79cf/schema)
