fork/exec ./debug: 不允许操作

fork/exec ./debug: operation not permitted

我的目标是能够从 Atom.io. into a docker container running go in dlv debugger 进行远程调试。这是第一个问题:

更新:1。我是 运行 Docker 容器在 mac 上,但这不应该影响代码签名,因为我是 运行 在容器中,对吧?

更新:2。 Codesignig主机,没有帮助。

Error:

1. root@...:/go/src/app# go get github.com/derekparker/delve/cmd/dlv

2. root@...:/go/src/app# dlv debug hello.go

could not launch process: fork/exec ./debug: operation not permitted

然后尝试

1. root@...:/go/src/app# sudo

2. bash: sudo: command not found

如果你用 --privileged 启动容器,它似乎可以工作。我试图弄清楚是否有更细粒度的功能但失败了。

另外我刚刚发现 https://github.com/steeve/homebrew-delve 这应该会让 OSX 上的事情变得更容易。

根据Delve Issue #515

Docker has security settings preventing ptrace(2) operations by default with in the container. Pass --security-opt seccomp:unconfined to docker run when starting.

*在官方 docker 错误跟踪器 https://github.com/docker/docker/issues/21051

中对此进行了确认

Docker 具有阻止 ptrace(2)

的安全设置

看看我是如何修复它的。

如果使用 docker-compose 文件到 运行 容器,然后在服务部分附加 seccomp:unconfined,如下所示

api: 
  security_opt:
    - seccomp:unconfined

如果使用 docker 运行 ...传递 seccomp:unconfined 也可以

运行 Docker 容器作为命令:

docker run -itd -p 2028:22 -p 2345:2345 --dns=10.236.8.8 --privileged=true --name=golang  centos7-golang  /usr/bin/supervisord

对我有用~