Docker命令-stats

命令

docker stats

描述

Display a live stream of container(s) resource usage statistics
显示容器的统计信息

用法

1
docker stats [OPTIONS] [CONTAINER...]

选项

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Options:
--all , -a Show all containers (default shows just running)
--format Pretty-print images using a Go template
--no-stream Disable streaming stats and only pull the first result
--no-trunc Do not truncate output

--format
table 以表格形式显示
.Container Container name or ID (user input)
.Name Container name
.ID Container 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)

注意

示例

1
2
3
4
5
6
7
$ docker stats
$ docker stats awesome_brattain 67b2525d8ad1
$ docker stats --all --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" fervent_panini 5acfcb1b4fd1 drunk_visvesvaraya big_heisenberg
$ docker stats --format "{{.Container}}: {{.CPUPerc}}"
$ docker stats --format "table {{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}"
# The default format is as follows on Linux
$ docker stats --format "table {{.ID}}\t{{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}"