Debian 12 bookworm
Sponsored Link

Docker : Display Container resource usage2023/06/22

 
You can check percentage of CPU, memory, network I/O for Containers.
[1] Check the resource usage of each container.
# display usage statistics with streaming

root@dlp:~#
docker stats

CONTAINER ID   NAME            CPU %     MEM USAGE / LIMIT     MEM %     NET I/O     BLOCK I/O     PIDS
247708e86d14   stoic_shirley   0.00%     21.53MiB / 15.62GiB   0.13%     656B / 0B   0B / 8.19kB   56
b56ecadaa98a   nervous_ride    0.00%     5.902MiB / 15.62GiB   0.04%     946B / 0B   0B / 4.1kB    9

# display without streaming

root@dlp:~#
docker stats --no-stream

CONTAINER ID   NAME            CPU %     MEM USAGE / LIMIT     MEM %     NET I/O       BLOCK I/O     PIDS
247708e86d14   stoic_shirley   0.00%     21.53MiB / 15.62GiB   0.13%     796B / 0B     0B / 8.19kB   56
b56ecadaa98a   nervous_ride    0.00%     5.902MiB / 15.62GiB   0.04%     1.02kB / 0B   0B / 4.1kB    9

# display for a specific container

root@dlp:~#
docker stats b56ecadaa98a --no-stream

CONTAINER ID   NAME           CPU %     MEM USAGE / LIMIT     MEM %     NET I/O       BLOCK I/O    PIDS
b56ecadaa98a   nervous_ride   0.00%     5.902MiB / 15.62GiB   0.04%     1.09kB / 0B   0B / 4.1kB   9

# display with specific format

root@dlp:~#
docker stats --no-stream --format "table {{.ID}} {{.CPUPerc}} {{.MemPerc}}"

CONTAINER ID CPU % MEM %
247708e86d14 0.00% 0.13%
b56ecadaa98a 0.00% 0.04%
Matched Content