The problem
I am able to set and reach a breakpoint if I compile and run from the host, but if I do it from within the docker container gdb does not
thanks the answer from @rubicks.
and if you can't use --privileged option(e.g. you are using a container from cloud), you can print stacktrace from your program:
--privileged
How to automatically generate a stacktrace when my gcc C++ program crashes