How to get host pid of a process running in gvisor sandbox?

30 views
Skip to first unread message

zl

unread,
Nov 29, 2020, 3:24:41 AM11/29/20
to gVisor Users [Public]
Hi, 

I want to get the host PID of a process that runs in the gvisor sandbox. But the information about processes running in the sandbox is the same in the host. It can't help me distinguish them.



Also, the method `docker inspect -f '{{.State.Pid}}' <container>` only can get the host PID of the sandbox. And `/sys/fs/cgroup/memory/docker/<container>/cgroup.procs` just provides all host PID in this container, which cannot provide the mapping relation.

So, is there possible that we can get a mapping relation of process PID between sandbox and host?

Thanks!

Ian Lewis

unread,
Nov 29, 2020, 7:50:05 PM11/29/20
to zl, gVisor Users [Public]
There isn't really a way of getting the host PID of a container because it's a platform specific implementation detail. I assume you're using ptrace, but with KVM for example you won't see host PIDs for each container.

Is there a specific reason you want this information?

--
You received this message because you are subscribed to the Google Groups "gVisor Users [Public]" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gvisor-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gvisor-users/63753e82-a04b-4612-bb5f-b68d97b6341an%40googlegroups.com.


--

Ian Lewis | Developer Advocate | ianl...@google.com | +81 (03)4540-2465

Reply all
Reply to author
Forward
0 new messages