GitLab Runner - 错误:无法删除网络进行构建

GitLab Runner - ERROR: Failed to remove network for build

提问人:Venelin 提问时间:12/8/2021 更新时间:8/8/2023 访问量:16179

问:

这是我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)

知道为什么我收到这个错误以及如何修复它吗?

gitlab gitlab-ci-runner

评论

0赞 Mr_Thorynque 12/9/2021
你如何配置 gitlab CI,也许 gitlab 无法加入 docker 端点 (docs.gitlab.com/ee/ci/docker/...),这不是由你的管道脚本引起的。

答:

-3赞 user18485474 3/17/2022 #1

此问题是由于您在 gitlab runner 中使用的 executor=“docker”。尝试更改为“shell”或“ssh”

1赞 Ali Bahrami 6/14/2022 #2

我有同样的问题。 我使用了“sudo gitlab-runner register”而不是“gitlab-runner register”,就我而言,问题解决了。

5赞 Brian Fraser 6/18/2022 #3

如果要使用 进行运行器设置,如果未在托管运行器的计算机上安装 docker,则可能会遇到错误。executor="docker""ERROR: Failed to remove network for build"

在 Ubuntu 中,尝试:

sudo apt install docker.io

然后重新运行管道。

评论

0赞 Ngrigri 7/18/2022
这个解决方案适用于我在 Ubuntu 20.04.4 LTS 上。
0赞 Jason Farnsworth 10/13/2022
这在 Ubuntu 22 上对我有用,谢谢!
1赞 alfC 1/13/2023
这在 Ubuntu 22.10 中对我没有帮助。问题可能是没有指定图像(这为我部分解决了此错误消息)。
0赞 AceP 5/13/2023 #4

您必须将图像添加到您的作业中。

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
 ...
1赞 Mikhail 8/8/2023 #5

如果安装了 docker 但您仍然收到错误,则需要授予用户使用 docker 的权限:

usermod -aG docker gitlab-runner