Allow docker stats without arguments
This patch adds the ability to run `docker stats` w/o arguments and get statistics for all running containers by default. Also add a new `--all` flag to list statistics for all containers (like `docker ps`). New running containers are added to the list as they show up also. Add integration tests for this new behavior. Docs updated accordingly. Fix missing stuff in man/commandline reference for `docker stats`. Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
f239640a2e
commit
4668b6ed6c
@ -10,24 +10,31 @@ parent = "smn_cli"
|
|||||||
|
|
||||||
# stats
|
# stats
|
||||||
|
|
||||||
Usage: docker stats [OPTIONS] CONTAINER [CONTAINER...]
|
Usage: docker stats [OPTIONS] [CONTAINER...]
|
||||||
|
|
||||||
Display a live stream of one or more containers' resource usage statistics
|
Display a live stream of one or more containers' resource usage statistics
|
||||||
|
|
||||||
|
-a, --all=false Show all containers (default shows just running)
|
||||||
--help=false Print usage
|
--help=false Print usage
|
||||||
--no-stream=false Disable streaming stats and only pull the first result
|
--no-stream=false Disable streaming stats and only pull the first result
|
||||||
|
|
||||||
Running `docker stats` on multiple containers
|
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.
|
||||||
|
|
||||||
$ docker stats redis1 redis2
|
If you want more detailed information about a container's resource usage, use the `/containers/(id)/stats` API endpoint.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
Running `docker stats` on all running containers
|
||||||
|
|
||||||
|
$ docker stats
|
||||||
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
|
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
|
||||||
redis1 0.07% 796 KB / 64 MB 1.21% 788 B / 648 B 3.568 MB / 512 KB
|
redis1 0.07% 796 KB / 64 MB 1.21% 788 B / 648 B 3.568 MB / 512 KB
|
||||||
redis2 0.07% 2.746 MB / 64 MB 4.29% 1.266 KB / 648 B 12.4 MB / 0 B
|
redis2 0.07% 2.746 MB / 64 MB 4.29% 1.266 KB / 648 B 12.4 MB / 0 B
|
||||||
|
nginx1 0.03% 4.583 MB / 64 MB 6.30% 2.854 KB / 648 B 27.7 MB / 0 B
|
||||||
|
|
||||||
|
Running `docker stats` on multiple containers by name and id.
|
||||||
|
|
||||||
The `docker stats` command will only return a live stream of data for running
|
$ docker stats fervent_panini 5acfcb1b4fd1
|
||||||
containers. Stopped containers will not return any data.
|
CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O
|
||||||
|
5acfcb1b4fd1 0.00% 115.2 MB/1.045 GB 11.03% 1.422 kB/648 B
|
||||||
> **Note:**
|
fervent_panini 0.02% 11.08 MB/1.045 GB 1.06% 648 B/648 B
|
||||||
> If you want more detailed information about a container's resource
|
|
||||||
> usage, use the API endpoint.
|
|
||||||
|
@ -6,15 +6,19 @@ docker-stats - Display a live stream of one or more containers' resource usage s
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
**docker stats**
|
**docker stats**
|
||||||
|
[**-a**|**--all**[=*false*]]
|
||||||
[**--help**]
|
[**--help**]
|
||||||
[**--no-stream**[=*false*]]
|
[**--no-stream**[=*false*]]
|
||||||
CONTAINER [CONTAINER...]
|
[CONTAINER...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
Display a live stream of one or more containers' resource usage statistics
|
Display a live stream of one or more containers' resource usage statistics
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
|
**-a**, **--all**=*true*|*false*
|
||||||
|
Show all containers. Only running containers are shown by default. The default is *false*.
|
||||||
|
|
||||||
**--help**
|
**--help**
|
||||||
Print usage statement
|
Print usage statement
|
||||||
|
|
||||||
@ -23,9 +27,17 @@ Display a live stream of one or more containers' resource usage statistics
|
|||||||
|
|
||||||
# EXAMPLES
|
# EXAMPLES
|
||||||
|
|
||||||
Run **docker stats** with multiple containers.
|
Running `docker stats` on all running containers
|
||||||
|
|
||||||
$ docker stats redis1 redis2
|
$ docker stats
|
||||||
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
|
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
|
||||||
redis1 0.07% 796 KB / 64 MB 1.21% 788 B / 648 B 3.568 MB / 512 KB
|
redis1 0.07% 796 KB / 64 MB 1.21% 788 B / 648 B 3.568 MB / 512 KB
|
||||||
redis2 0.07% 2.746 MB / 64 MB 4.29% 1.266 KB / 648 B 12.4 MB / 0 B
|
redis2 0.07% 2.746 MB / 64 MB 4.29% 1.266 KB / 648 B 12.4 MB / 0 B
|
||||||
|
nginx1 0.03% 4.583 MB / 64 MB 6.30% 2.854 KB / 648 B 27.7 MB / 0 B
|
||||||
|
|
||||||
|
Running `docker stats` on multiple containers by name and id.
|
||||||
|
|
||||||
|
$ docker stats fervent_panini 5acfcb1b4fd1
|
||||||
|
CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O
|
||||||
|
5acfcb1b4fd1 0.00% 115.2 MB/1.045 GB 11.03% 1.422 kB/648 B
|
||||||
|
fervent_panini 0.02% 11.08 MB/1.045 GB 1.06% 648 B/648 B
|
||||||
|
Loading…
x
Reference in New Issue
Block a user