Skip to content

Instantly share code, notes, and snippets.

@jebeaudet
Created December 11, 2019 18:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jebeaudet/f2fbd78e8b771f1d3c3924c9ccd73fbb to your computer and use it in GitHub Desktop.
Save jebeaudet/f2fbd78e8b771f1d3c3924c9ccd73fbb to your computer and use it in GitHub Desktop.
Map PID from Host to docker container
PID from the threads/process will be different from the host that from inside the container.
This makes reading thread dump tricky as the thread dump will show the nid of inside the container however you might be checking CPU usage from the host!
To find the mapping of the two, it's easy. Find the PID of the thread/process on the host.
After this, run `cat /proc/{PID}/status |grep NSpid`. Example :
```
NSpid: 31144 83
```
This means that the PID 31144 on the host equals 83 inside the container. Now rejoice!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment