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官方文档 传送门
Comments | NOTHING