Published 6月 19, 2019 by with 0 comment

8 - 01 - Docker ps/top/stats



In this lab, I will show several docker commands to monitor docker container stats.

1. docker container ps
[peter@peter-KVM ~ [host1]]$ docker container ps --help

Usage:  docker container ls [OPTIONS]

List containers

Aliases:
  ls, ps, list

Options:
  -a, --all             Show all containers (default shows just running)
  -f, --filter filter   Filter output based on conditions provided
      --format string   Pretty-print containers using a Go template
  -n, --last int        Show n last created containers (includes all states) (default -1)
  -l, --latest          Show the latest created container (includes all states)
      --no-trunc        Don't truncate output
  -q, --quiet           Only display numeric IDs
  -s, --size            Display total file sizes
[peter@peter-KVM ~ [host1]]$ 
[peter@peter-KVM ~ [host1]]$ docker container ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
a0d19586bce3        busybox             "sh"                22 hours ago        Up 22 hours                             bbox21
763452dea2bb        busybox             "sh"                22 hours ago        Up 22 hours                             bbox11
2385aa381269        busybox             "sh"                23 hours ago        Up 23 hours                             bbox1
[peter@peter-KVM ~ [host1]]$ 


2. docker container top
[peter@peter-KVM ~ [host1]]$ docker container top --help

Usage:  docker container top CONTAINER [ps OPTIONS]

Display the running processes of a container
[peter@peter-KVM ~ [host1]]$ 
[peter@peter-KVM ~ [host1]]$ docker container top bbox1
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                13538               13514               0                   Jun18               pts/0               00:00:00            sh
[peter@peter-KVM ~ [host1]]$  
[peter@peter-KVM ~ [host1]]$ docker container top bbox1 -au
USER                PID                 %CPU                %MEM                VSZ                 RSS                 TTY                 STAT                START               TIME                COMMAND
root                13538               0.0                 0.0                 1304                4                   pts/0               Ss+                 Jun18               0:00                sh
[peter@peter-KVM ~ [host1]]$ 


3. docker container stats
[peter@peter-KVM ~ [host1]]$ docker container stats --help

Usage:  docker container stats [OPTIONS] [CONTAINER...]

Display a live stream of container(s) resource usage statistics

Options:
  -a, --all             Show all containers (default shows just running)
      --format string   Pretty-print images using a Go template
      --no-stream       Disable streaming stats and only pull the first result
      --no-trunc        Do not truncate output
[peter@peter-KVM ~ [host1]]$
[peter@peter-KVM ~ [host1]]$ docker container stats 
CONTAINER ID        NAME                CPU %               MEM USAGE / LIMIT   MEM %               NET I/O             BLOCK I/O           PIDS
a0d19586bce3        bbox21              0.00%               640KiB / 1.947GiB   0.03%               280B / 280B         0B / 0B             1
763452dea2bb        bbox11              0.00%               616KiB / 1.947GiB   0.03%               7.97MB / 7.97MB     0B / 0B             1
2385aa381269        bbox1               0.00%               604KiB / 1.947GiB   0.03%               280B / 280B         0B / 0B             1
[peter@peter-KVM ~ [host1]]$


最初發表 / 最後更新: 2019.06.19 / 2019.06.19

0 comments:

張貼留言