gdb in docker container returns “ptrace: Operation not permitted.”

后端 未结 1 677
Happy的楠姐
Happy的楠姐 2021-02-01 14:26

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

1条回答
  •  攒了一身酷
    2021-02-01 15:06

    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

    0 讨论(0)
提交回复
热议问题