Why not just restart the container?
@ntwrkguru How about for the scenario that you cannot restart the container because you need to troubleshoot the process running in the container as-is?
I have yet to find a solution for debugging a running process in a running container. We have been trying something like
watch -n 1 'cat /proc/<PID>/task/<PID>/status' but I can’t find anything in there that points me to current syscalls and their output.
I am struggling with the same - where I need to troubleshoot a process running in a container as-is, restarting is not an option.
I have a python process in a docker container, which occasionally gets “stuck” and I try to figure out why.
The app is running by a dedicated app user, so I have logged in with root and then I have tried pyrasite within the container:
$ pip install pyrasite
$ echo 0 | tee /proc/sys/kernel/yama/ptrace_scope
$ pyrasite [PID] dump_stacks.py --verbose
b’ptrace: Operation not permitted.\nNo symbol table is loaded. Use the “file” command.\nNo symbol table is loaded. Use the “file” command.\nNo symbol table is loaded. Use the “file” command.\n’
I too am yet to find a solution for debugging a running process in a running container.
For now I just create a special, “debug” version of my container with the following flags to allow me to run gdb: