Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are debugging restrictions inside Docker?

I am debugging a compiled (c++) python module which mysteriously crashes at import time inside docker container. When I run python3 inside gdb, then import, and then try to print backtrace, I only get

# gdb /usr/bin/pyton3
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.
...
(gdb) run -c 'import myModule'
warning: Error disabling address space randomization: Operation not permitted
During startup program terminated with signal SIGSEGV, Segmentation fault.
(gdb) bt
No stack.
(gdb)

Are there some restriction what gdb can(not) do inside a Docker container? The crash in itself is surprising, but the inability to debug it even more so. The module is compiled with -ggdb2 to include as much debugging information as possible.

like image 791
eudoxos Avatar asked Jan 31 '23 00:01

eudoxos


1 Answers

For the record: debugging (and also strace) need the CAP_PTRACE capability. The problem was solved by running the container with --privileged.

like image 178
eudoxos Avatar answered Feb 05 '23 16:02

eudoxos