I am trying to get a thread dump of a Java service running inside Docker container. I got into the container terminal using the following command.
sudo docker exec -u 1000:0 -ti MyService /bin/bash
When I now run the following jstack command,
[ecs-user@myComputer /]$ jstack -l 436 > thread.dump
I get the following error.
bash: thread.dump: Permission denied
My docker container runAsUser is specified as ecs-user
and that's the user the bash shell is running as. What permissions do I grant this user on which files to be able to do this thread dump? Or are there any other alternatives with jstack? Would appreciate any suggestions/advice. Thanks in advance.