Container Performance Monitoring
Beginner5 min
Monitor CPU, memory, network, and I/O usage of running containers to identify performance bottlenecks.
Prerequisites
- -Docker installed
- -Running containers
Steps
1
View real-time stats for all containers
Monitor resource usage across all running containers.
$ docker stats
2
Get a single snapshot of stats
Capture a one-time snapshot without streaming for scripts and logging.
$ docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}\t{{.NetIO}}\t{{.BlockIO}}'
3
Inspect container resource limits
Check what resource limits are set for a container.
$ docker inspect <container-name> --format '{{.HostConfig.Memory}} {{.HostConfig.CpuQuota}}'
Memory is in bytes. Divide by 1048576 to get MB. CpuQuota of 100000 = 1 CPU core.
Full Script
FAQ
Discussion
Loading comments...