github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/docs/reference/commandline/stats.md (about) 1 <!--[metadata]> 2 +++ 3 title = "stats" 4 description = "The stats command description and usage" 5 keywords = ["container, resource, statistics"] 6 [menu.main] 7 parent = "smn_cli" 8 +++ 9 <![end-metadata]--> 10 11 # stats 12 13 ```markdown 14 Usage: docker stats [OPTIONS] [CONTAINER...] 15 16 Display a live stream of container(s) resource usage statistics 17 18 Options: 19 -a, --all Show all containers (default shows just running) 20 --help Print usage 21 --no-stream Disable streaming stats and only pull the first result 22 ``` 23 24 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. 25 26 If you want more detailed information about a container's resource usage, use the `/containers/(id)/stats` API endpoint. 27 28 ## Examples 29 30 Running `docker stats` on all running containers against a Linux daemon. 31 32 $ docker stats 33 CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O 34 1285939c1fd3 0.07% 796 KiB / 64 MiB 1.21% 788 B / 648 B 3.568 MB / 512 KB 35 9c76f7834ae2 0.07% 2.746 MiB / 64 MiB 4.29% 1.266 KB / 648 B 12.4 MB / 0 B 36 d1ea048f04e4 0.03% 4.583 MiB / 64 MiB 6.30% 2.854 KB / 648 B 27.7 MB / 0 B 37 38 Running `docker stats` on multiple containers by name and id against a Linux daemon. 39 40 $ docker stats fervent_panini 5acfcb1b4fd1 41 CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O 42 5acfcb1b4fd1 0.00% 115.2 MiB/1.045 GiB 11.03% 1.422 kB/648 B 43 fervent_panini 0.02% 11.08 MiB/1.045 GiB 1.06% 648 B/648 B 44 45 Running `docker stats` on all running containers against a Windows daemon. 46 47 PS E:\> docker stats 48 CONTAINER CPU % PRIV WORKING SET NET I/O BLOCK I/O 49 09d3bb5b1604 6.61% 38.21 MiB 17.1 kB / 7.73 kB 10.7 MB / 3.57 MB 50 9db7aa4d986d 9.19% 38.26 MiB 15.2 kB / 7.65 kB 10.6 MB / 3.3 MB 51 3f214c61ad1d 0.00% 28.64 MiB 64 kB / 6.84 kB 4.42 MB / 6.93 MB 52 53 Running `docker stats` on multiple containers by name and id against a Windows daemon. 54 55 PS E:\> docker ps -a 56 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 57 3f214c61ad1d nanoserver "cmd" 2 minutes ago Up 2 minutes big_minsky 58 9db7aa4d986d windowsservercore "cmd" 2 minutes ago Up 2 minutes mad_wilson 59 09d3bb5b1604 windowsservercore "cmd" 2 minutes ago Up 2 minutes affectionate_easley 60 61 PS E:\> docker stats 3f214c61ad1d mad_wilson 62 CONTAINER CPU % PRIV WORKING SET NET I/O BLOCK I/O 63 3f214c61ad1d 0.00% 46.25 MiB 76.3 kB / 7.92 kB 10.3 MB / 14.7 MB 64 mad_wilson 9.59% 40.09 MiB 27.6 kB / 8.81 kB 17 MB / 20.1 MB 65 66 ## Formatting 67 68 The formatting option (`--format`) pretty prints container output 69 using a Go template. 70 71 Valid placeholders for the Go template are listed below: 72 73 Placeholder | Description 74 ------------ | -------------------------------------------- 75 `.Container` | Container name or ID 76 `.CPUPerc` | CPU percentage 77 `.MemUsage` | Memory usage 78 `.NetIO` | Network IO 79 `.BlockIO` | Block IO 80 `.MemPerc` | Memory percentage (Not available on Windows) 81 `.PIDs` | Number of PIDs (Not available on Windows) 82 83 84 When using the `--format` option, the `stats` command either 85 outputs the data exactly as the template declares or, when using the 86 `table` directive, includes column headers as well. 87 88 The following example uses a template without headers and outputs the 89 `Container` and `CPUPerc` entries separated by a colon for all images: 90 91 ```bash 92 $ docker stats --format "{{.Container}}: {{.CPUPerc}}" 93 94 09d3bb5b1604: 6.61% 95 9db7aa4d986d: 9.19% 96 3f214c61ad1d: 0.00% 97 ``` 98 99 To list all containers statistics with their name, CPU percentage and memory 100 usage in a table format you can use: 101 102 ```bash 103 $ docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" 104 105 CONTAINER CPU % PRIV WORKING SET 106 1285939c1fd3 0.07% 796 KiB / 64 MiB 107 9c76f7834ae2 0.07% 2.746 MiB / 64 MiB 108 d1ea048f04e4 0.03% 4.583 MiB / 64 MiB 109 ```