Linux command
docker-container-stats 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Show live resource usage
docker container stats
Show stats for specific containers
docker container stats [container1] [container2]
Show one-time snapshot
docker container stats --no-stream
Custom format
docker container stats --format "{{.Name}}: {{.CPUPerc}}"
说明
docker container stats displays a live stream of container resource usage statistics, providing real-time visibility into CPU percentage, memory usage and limit, network I/O, and block I/O for running containers. By default, the display continuously updates with current metrics for all running containers. The --no-stream option provides a single snapshot instead of continuous updates, which is useful for scripting and automation.
参数
- --no-stream
- Disable streaming, show single snapshot.
- -a, --all
- Show all containers (default shows running).
- --format _string_
- Format output using Go template. Placeholders: .Container, .Name, .ID, .CPUPerc, .MemUsage, .MemPerc, .NetIO, .BlockIO, .PIDs.
- --no-trunc
- Do not truncate output (show full container IDs).
FAQ
What is the docker-container-stats command used for?
docker container stats displays a live stream of container resource usage statistics, providing real-time visibility into CPU percentage, memory usage and limit, network I/O, and block I/O for running containers. By default, the display continuously updates with current metrics for all running containers. The --no-stream option provides a single snapshot instead of continuous updates, which is useful for scripting and automation.
How do I run a basic docker-container-stats example?
Run `docker container stats` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --no-stream do in docker-container-stats?
Disable streaming, show single snapshot.