I have more than one java application running in separate docker containers. I am trying to collect monitoring data such as GC log, thread dump, heap dump from the java process running inside a container using tools like jstat, jstack, jmap. Is it possible to capture this information from the host(outside containers)?
I am new to the containerized world. I understand that PID namespace of the host and container is different. When I execute jstack <PID> > thread_dump.txt
from the host, it shows error message: Unable to open socket file /proc/root/tmp/.java_pid: target process doesn't respond within 10500ms or HotSpot VM not loaded
Where PID is process id from the host PID namespace.
When I execute jstack
inside container ( docker exec -it <container_id_or_name>
) then it is able to capture thread dump.
Where PID is process id from the container PID namespace.
Any hints on how to solve this?