docker容器运维命令-docker top

时间:2024-01-28 15:58:10

查看容器中运行的进程信息,支持 ps 命令参数。

docker top [OPTIONS] CONTAINER [ps OPTIONS]

示例:

# 查看所有运行容器的进程信息。
for i in `docker ps |grep Up|awk '{print $1}'`;do echo \ &&docker top $i; done
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
165536              1835                1811                0                   05:35               ?                   00:00:00            nginx: master process nginx -g daemon off;
165637              1898                1835                0                   05:35               ?                   00:00:00            nginx: worker process
165637              1899                1835                0                   05:35               ?                   00:00:00            nginx: worker process