I\'ve checked /proc/sys/kernel/yama/ptrace_scope in the container and on the host - both report the value as zero but when attached to pid one gdb reports
/proc/sys/kernel/yama/ptrace_scope
I discovered the answer - the container needs to be started with strace capabilities
Adding this to my docker-compose.yml file allows GDB to work
cap_add: - SYS_PTRACE
Or it can also be passed on the docker command line with --cap-add=SYS_PTRACE
--cap-add=SYS_PTRACE