NAME 名称

podman-top - Display the running processes of a container
podman-top - 显示容器的运行进程

SYNOPSIS 概要

podman top [options] container [format-descriptors]
podman top [选项] 容器 [格式描述符]

podman container top [options] container [format-descriptors]
podman 容器 top [选项] 容器 [格式描述符]

DESCRIPTION 描述

Display the running processes of the container. The format-descriptors are ps (1) compatible AIX format descriptors but extended to print additional information, such as the seccomp mode or the effective capabilities of a given process. The descriptors can either be passed as separated arguments or as a single comma-separated argument. Note that options and or flags of ps(1) can also be specified; in this case, Podman falls back to executing ps(1) from the host with the specified arguments and flags in the container namespace. If the container has the CAP_SYS_PTRACE capability then we will execute ps(1) in the container so it must be installed there. To extract host-related information, use the “h*” descriptors. For instance, podman top $name hpid huser to display the PID and user of the processes in the host context.
显示容器的运行进程。格式描述符是 ps(1)兼容的 AIX 格式描述符,但扩展到打印附加信息,例如 seccomp 模式或给定进程的有效能力。描述符可以作为单独的参数传递,也可以作为单个逗号分隔的参数传递。请注意,也可以指定 ps(1)的选项和标志;在这种情况下,Podman 将退回到在容器命名空间中使用指定的参数和标志执行主机上的 ps(1)。如果容器具有 CAP_SYS_PTRACE 能力,则我们将在容器中执行 ps(1),因此必须在那里安装它。要提取与主机相关的信息,请使用“h*”描述符。例如, podman top $name hpid huser 以在主机上下文中显示进程的 PID 和用户。

OPTIONS 选项

--help, -h --help,-h ¶

Print usage statement 打印使用说明

--latest, -l

Instead of providing the container name or ID, use the last created container. Note: the last started container can be from other users of Podman on the host machine. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)
不要提供容器名称或 ID,而是使用最后创建的容器。注意:最后启动的容器可能来自主机上其他 Podman 用户。(此选项在远程 Podman 客户端中不可用,包括 Mac 和 Windows(不包括 WSL2)主机)

FORMAT DESCRIPTORS 格式描述符 ¶

The following descriptors are supported in addition to the AIX format descriptors mentioned in ps (1):
除了 ps(1)中提到的 AIX 格式描述符之外,还支持以下描述符:

args, capbnd, capeff, capinh, capprm, comm, etime, group, hgroup, hpid, huser, label, nice, pcpu, pgid, pid, ppid, rgroup, ruser, seccomp, state, time, tty, user, vsz
args、capbnd、capeff、capinh、capprm、comm、etime、group、hgroup、hpid、huser、label、nice、pcpu、pgid、pid、ppid、rgroup、ruser、seccomp、state、time、tty、user、vsz

capbnd 能力绑定

Set of bounding capabilities. See capabilities (7) for more information.
一组边界能力。有关更多信息,请参阅能力 (7)。

capeff 能力效果

Set of effective capabilities. See capabilities (7) for more information.
一组有效的功能。有关更多信息,请参阅功能(7)。

capinh

Set of inheritable capabilities. See capabilities (7) for more information.
一组可继承的功能。有关更多信息,请参阅功能(7)。

capprm 允许的功能集

Set of permitted capabilities. See capabilities (7) for more information.
允许的功能集。有关更多信息,请参阅功能(7)。

hgroup

The corresponding effective group of a container process on the host.
容器进程在主机上的对应有效组。

hpid

The corresponding host PID of a container process.
容器进程的对应主机 PID。

huser 用户

The corresponding effective user of a container process on the host.
主机上容器进程的对应有效用户。

label 标签

Current security attributes of the process.
进程的当前安全属性。

seccomp

Seccomp mode of the process (i.e., disabled, strict or filter). See seccomp (2) for more information.
进程的 Seccomp 模式(即禁用、严格或过滤)。有关更多信息,请参阅 seccomp(2)。

state 状态

Process state codes (e.g, R for running, S for sleeping). See proc(5) for more information.
进程状态代码(例如,运行中的 R,睡眠中的 S)。有关更多信息,请参阅 proc(5)。

stime 启动时间

Process start time (e.g, “2019-12-09 10:50:36 +0100 CET).
进程启动时间(例如,“2019-12-09 10:50:36 +0100 CET)。

EXAMPLES 示例

By default, podman-top prints data similar to ps -ef.
默认情况下, podman-top 打印类似于 ps -ef 的数据。

$ podman top f5a62a71b07
USER   PID   PPID   %CPU    ELAPSED         TTY     TIME   COMMAND
root   1     0      0.000   20.386825206s   pts/0   0s     sh
root   7     1      0.000   16.386882887s   pts/0   0s     sleep
root   8     1      0.000   11.386886562s   pts/0   0s     vi

The output can be controlled by specifying format descriptors as arguments after the container.
可以通过在容器后指定格式描述符作为参数来控制输出。

$ podman top -l pid seccomp args %C
PID   SECCOMP   COMMAND     %CPU
1     filter    sh          0.000
8     filter    vi /etc/    0.000

Podman falls back to executing ps(1) from the host in the container namespace if an unknown descriptor is specified.
如果指定了未知描述符,Podman 将退回到在容器命名空间中从主机执行 ps(1)。

$ podman top -l -- aux
USER   PID   PPID   %CPU    ELAPSED             TTY   TIME   COMMAND
root   1     0      0.000   1h2m12.497061672s   ?     0s     sleep 100000

SEE ALSO 参见 ¶

podman(1), ps(1), seccomp(2), proc(5), capabilities(7)

HISTORY 历史 ¶

July 2018, Introduce format descriptors by Valentin Rothberg vrothberg@suse.com
2018 年 7 月,由 Valentin Rothberg vrothberg@suse.com 引入格式描述符

December 2017, Originally compiled by Brent Baude bbaude@redhat.com
2017 年 12 月,最初由 Brent Baude bbaude@redhat.com 编译