GItLab使用pipline持续集成时报错“/bin/sh: Operation not permitted”


GItLab使用pipline持续集成时报错“/bin/sh: Operation not permitted”

GitLab runner 执行器为docker又需要特权执行脚本时会报一下错误:

$ make build
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o task main.go
make: /bin/sh: Operation not permitted
make: *** [Makefile:8: build] Error 127
Running after_script
Uploading artifacts for failed job
ERROR: Job failed: exit code 2

解决

需要在修改runner的配置文件(config.toml)开启容器的特权模式

[[runners]]
  executor = "docker"
  [runners.docker]
    privileged = true

GitLab官方文档 传送门

声明:初心|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - GItLab使用pipline持续集成时报错“/bin/sh: Operation not permitted”


愿你勿忘初心,并从一而终