这是我的 gitlab-ci.yml:
image: vibraniumcore/gcc-cmake-boost-mysqlcon
#image: gitlab/dind
stages:
- test
- build
Run Tests:
stage: test
tags:
- c++
script:
- mkdir build
- cd build
- cmake ..
- cmake --build . --target VibraniumCoreTests
- cd ./Tests
- ./VibraniumCoreTests
Build VibraniumCore:
stage: build
tags:
- c++
script:
- mkdir build
- cd build
- cmake ..
- cmake --build .
Build AuthServer:
stage: build
tags:
- c++
script:
- cd Scripts
- ./build_authserver.sh
Build WorldServer:
stage: build
tags:
- c++
script:
- cd Scripts
- ./build_worldserver.sh
当我尝试运行管道时,出现此错误:
Running with gitlab-runner 13.1.1 (6fbc7474)
on GCC-CMAKE HdBd6UX6
Preparing the "docker" executor
00:35
ERROR: Failed to remove network for build
ERROR: Preparation failed: error during connect: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.25/info: read unix @->/var/run/docker.sock: read: connection reset by peer (docker.go:894:4s)
Will be retried in 3s ...
ERROR: Failed to remove network for build
ERROR: Preparation failed: error during connect: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.25/info: read unix @->/var/run/docker.sock: read: connection reset by peer (docker.go:894:10s)
Will be retried in 3s ...
ERROR: Failed to remove network for build
ERROR: Preparation failed: error during connect: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.25/info: read unix @->/var/run/docker.sock: read: connection reset by peer (docker.go:894:10s)
Will be retried in 3s ...
ERROR: Job failed (system failure): error during connect: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.25/info: read unix @->/var/run/docker.sock: read: connection reset by peer (docker.go:894:10s)
知道为什么我会收到此错误以及如何修复它吗?
如果您想使用
executor="docker"
设置运行器,并且尚未在托管运行器的计算机上安装 docker,则可能会遇到 "ERROR: Failed to remove network for build"
错误。
在 Ubuntu 中,尝试:
sudo apt install docker.io
然后重新运行管道。
您必须向您的作业添加图像。
run_tests:
stage: test
image: vibraniumcore/gcc-cmake-boost-mysqlcon # add this line here
tags:
- c++
...
或使用默认图片:
default: # add this line here
image: vibraniumcore/gcc-cmake-boost-mysqlcon
run_tests:
stage: test
...
如果安装了 docker 但仍然出现错误,那么你需要授予用户使用 docker 的权限:
usermod -aG docker gitlab-runner
我也有同样的问题。 我使用“sudo gitlab-runner register”而不是“gitlab-runner register”,就我而言,问题已解决。
此问题是由于您在 gitlab runner 中使用的 executor="docker" 造成的。尝试更改为“shell”或“ssh”