On Thu, 28 Apr 2011, Ulli Horlacher wrote: > Is there a way to get the corresponding host PID for a container PID? > > For example: inside the the container the process "init" has always PID 1. > But what PID has this process in the host process table? > > ps aux | grep ... is not what I am looking for, I want more robust solution.
lxc-ps ? >From Dobrica Pavlinusic's LXC script: init_pid=`lxc-ps -C init -o pid | grep "^$name" | cut -d" " -f2-` So if you're looking for 'init' in a container called pegasus: lxc-ps -C init -o pid | grep "^pegasus" | cut -d" " -f2- Yields 24766 on my system, and a regular ps ax | fgrep init does give: 24766 ? Ss 7:55 init [2] (amongst others) Gordon ------------------------------------------------------------------------------ WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd _______________________________________________ Lxc-users mailing list Lxc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-users