问题描述
我正在对码头和集装箱进行一些测试,我想知道是否?有没有一种方法可以用来查找与码头容器关联的所有进程它的名称或ID从主机的角度。
因为在一天的最后一个容器是一组虚拟化进程。
您可以使用 docker top
命令。
此命令列出在容器中运行的所有进程。
例如,我的框上单个进程容器上的此命令显示:
UID PID PPID C STIME TTY TIME CMD
root 14097 13930 0 23:17 pts / 6 00:00:00 / bin / bash
其他人提到的所有方法也可以使用,但这应该是最简单的。
更新:
要简单地获取容器内的主进程标识符,请使用以下命令:
docker inspect -f'{{.State.Pid}}'< container id>
I am doing some tests on docker and containers and I was wondering if ?
Is there a method I can use to find all process associated with a docker container by its name or ID from the host point of view.
Because at the end of the day a container is set of virtualized processes.
You can use docker top
command.This command lists all processes running within your container.
For instance this command on a single process container on my box displays:
UID PID PPID C STIME TTY TIME CMD
root 14097 13930 0 23:17 pts/6 00:00:00 /bin/bash
All methods mentioned by others are also possible to use but this one should be easiest.
Update:
To simply get the main process id within the container use this command:
docker inspect -f '{{.State.Pid}}' <container id>
这篇关于查找Docker容器进程?从主机的角度来看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!