strace: attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted
2020-12-08 19:50:05    126    0    0
admin

在docker里面用strace -p pid 查看进程当前调用栈报错

$ strace -p 7
ptrace(PTRACE_ATTACH, ...): Operation not permitted   //报错信息

I would like to add that I needed --security-opt apparmor=unconfined along with the options that @wisbucky mentioned. This was on Ubuntu 18.04 (both Docker client and host). Therefore, the full invocation for enabling gdb debugging within a container is:
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --security-opt apparmor=unconfined
摘自 How to solve “ptrace operation not permitted” when trying to attach GDB to a process?

docker 官方解析

The solution for enabling of ptrace and PTRACE_ATTACH in Docker Containers

上一篇: 吐血整理的GO语言部分框架、库必学清单!带你开启机器学习!

下一篇: 想安装更多 Linux 发行版?LxRunOffline 让 WSL 更好用

126
登录 后评论.
没有帐号? 现在注册.
0 评论
Table of content