2016-10-14 18:30:36 -04:00
---
title: "stats"
description: "The stats command description and usage"
2016-11-03 18:48:30 -04:00
keywords: "container, resource, statistics"
2016-10-14 18:30:36 -04:00
---
2015-06-21 16:41:38 -04:00
2016-10-19 13:25:45 -04:00
<!-- This file is maintained within the docker/docker Github
repository at https://github.com/docker/docker/. Make all
pull requests against that repo. If you see this file in
another repository, consider it read-only there, as it will
periodically be overwritten by the definitive file. Pull
requests which include edits to this file in other repositories
will be rejected.
-->
2015-06-21 16:41:38 -04:00
# stats
2016-07-07 14:43:18 -04:00
```markdown
Usage: docker stats [OPTIONS] [CONTAINER...]
2015-06-21 16:41:38 -04:00
2016-07-07 14:43:18 -04:00
Display a live stream of container(s) resource usage statistics
2015-06-21 16:41:38 -04:00
2016-07-07 14:43:18 -04:00
Options:
-a, --all Show all containers (default shows just running)
--help Print usage
--no-stream Disable streaming stats and only pull the first result
```
2015-06-21 16:41:38 -04:00
2015-10-03 08:53:25 -04:00
The `docker stats` command returns a live data stream for running containers. To limit data to one or more specific containers, specify a list of container names or ids separated by a space. You can specify a stopped container but stopped containers do not return any data.
2015-06-21 16:41:38 -04:00
2016-09-25 10:07:15 -04:00
If you want more detailed information about a container's resource usage, use the `/containers/(id)/stats` API endpoint.
2015-10-03 08:53:25 -04:00
## Examples
2016-09-07 19:08:51 -04:00
Running `docker stats` on all running containers against a Linux daemon.
2015-10-03 08:53:25 -04:00
$ docker stats
2015-07-26 04:14:00 -04:00
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
2016-04-05 15:30:35 -04:00
1285939c1fd3 0.07% 796 KiB / 64 MiB 1.21% 788 B / 648 B 3.568 MB / 512 KB
9c76f7834ae2 0.07% 2.746 MiB / 64 MiB 4.29% 1.266 KB / 648 B 12.4 MB / 0 B
d1ea048f04e4 0.03% 4.583 MiB / 64 MiB 6.30% 2.854 KB / 648 B 27.7 MB / 0 B
2015-06-21 16:41:38 -04:00
2016-09-07 19:08:51 -04:00
Running `docker stats` on multiple containers by name and id against a Linux daemon.
2015-06-21 16:41:38 -04:00
2015-10-03 08:53:25 -04:00
$ docker stats fervent_panini 5acfcb1b4fd1
2016-09-25 10:07:15 -04:00
CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O
2016-04-05 15:30:35 -04:00
5acfcb1b4fd1 0.00% 115.2 MiB/1.045 GiB 11.03% 1.422 kB/648 B
fervent_panini 0.02% 11.08 MiB/1.045 GiB 1.06% 648 B/648 B
2016-09-07 19:08:51 -04:00
Running `docker stats` on all running containers against a Windows daemon.
PS E:\> docker stats
CONTAINER CPU % PRIV WORKING SET NET I/O BLOCK I/O
09d3bb5b1604 6.61% 38.21 MiB 17.1 kB / 7.73 kB 10.7 MB / 3.57 MB
9db7aa4d986d 9.19% 38.26 MiB 15.2 kB / 7.65 kB 10.6 MB / 3.3 MB
3f214c61ad1d 0.00% 28.64 MiB 64 kB / 6.84 kB 4.42 MB / 6.93 MB
Running `docker stats` on multiple containers by name and id against a Windows daemon.
PS E:\> docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3f214c61ad1d nanoserver "cmd" 2 minutes ago Up 2 minutes big_minsky
9db7aa4d986d windowsservercore "cmd" 2 minutes ago Up 2 minutes mad_wilson
09d3bb5b1604 windowsservercore "cmd" 2 minutes ago Up 2 minutes affectionate_easley
2016-09-25 10:07:15 -04:00
2016-09-07 19:08:51 -04:00
PS E:\> docker stats 3f214c61ad1d mad_wilson
CONTAINER CPU % PRIV WORKING SET NET I/O BLOCK I/O
3f214c61ad1d 0.00% 46.25 MiB 76.3 kB / 7.92 kB 10.3 MB / 14.7 MB
2016-09-25 10:07:15 -04:00
mad_wilson 9.59% 40.09 MiB 27.6 kB / 8.81 kB 17 MB / 20.1 MB
## Formatting
The formatting option (`--format`) pretty prints container output
using a Go template.
Valid placeholders for the Go template are listed below:
Placeholder | Description
------------ | --------------------------------------------
`.Container` | Container name or ID
`.CPUPerc` | CPU percentage
`.MemUsage` | Memory usage
`.NetIO` | Network IO
`.BlockIO` | Block IO
`.MemPerc` | Memory percentage (Not available on Windows)
`.PIDs` | Number of PIDs (Not available on Windows)
When using the `--format` option, the `stats` command either
outputs the data exactly as the template declares or, when using the
`table` directive, includes column headers as well.
The following example uses a template without headers and outputs the
`Container` and `CPUPerc` entries separated by a colon for all images:
```bash
$ docker stats --format "{{.Container}}: {{.CPUPerc}}"
09d3bb5b1604: 6.61%
9db7aa4d986d: 9.19%
3f214c61ad1d: 0.00%
```
To list all containers statistics with their name, CPU percentage and memory
usage in a table format you can use:
```bash
$ docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}"
CONTAINER CPU % PRIV WORKING SET
1285939c1fd3 0.07% 796 KiB / 64 MiB
9c76f7834ae2 0.07% 2.746 MiB / 64 MiB
d1ea048f04e4 0.03% 4.583 MiB / 64 MiB
```