Finding Docker container processes? (from host point of view)

后端 未结 7 940
盖世英雄少女心
盖世英雄少女心 2020-12-07 12:17

I am doing some tests on docker and containers and I was wondering:

Is there a method I can use to find all process associated with a docker container by its name or

7条回答
  •  清歌不尽
    2020-12-07 12:53

    When running this on the host, it will give you a list of processes running in a container with , showing host PIDs instead of container PIDs.

    DID=$(docker inspect -f '{{.State.Pid}}' );ps --ppid $DID -o pid,ppid,cmd
    

提交回复
热议问题