Failed to remove network for build, Cannot connect to the Docker daemon at unix:///var/run/docker.sock
I'm setting up a self-hosted Gitlab runner on my k8s cluster to config Docker shm_size and FF_NETWORK_PER_BUILD = true for my Selenium tests.
The runner installed with helm chart selected kubernetes as the default executor so I made some changes to switch to docker executor (I think FF_NETWORK_PER_BUILD = true only works with this executor), here values.yaml config
runners:
config: |
[[runners]]
[runners.docker]
image = "ubuntu:22.04"
shm_size = 2000000
[runners.feature_flags]
FF_NETWORK_PER_BUILD = true
executor: docker
and my .gitlab-ci.yaml
test:
stage: test
image: registry.gitlab.com/my-image:dev
variables:
FF_NETWORK_PER_BUILD: "true"
services:
- name: selenium/standalone-firefox:latest
alias: selenium-firefox
script:
- SE_BROWSER_URL=http://selenium-firefox:4444 pytest --capture=no --exitfirst tests/views/test_ui.py
running CI errored out this
Running with gitlab-runner 17.0.0 (44feccdf)
on gitlab-runner-b4fdcfd67-jg99w do74nDj2a, system ID: r_JSfZyZgrtx2d
feature flags: FF_NETWORK_PER_BUILD:true
Resolving secrets
Preparing the "docker" executor
00:09
ERROR: Failed to remove network for build
ERROR: Preparation failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (docker.go:951:0s)
- Previous launch with
kubernetesexecutor
Running with gitlab-runner 17.0.0 (44feccdf)
on gitlab-runner-6d77878889-8r95h do74nDj2a, system ID: r_WBSlhQ00r67x
feature flags: FF_NETWORK_PER_BUILD:true
Resolving secrets
Preparing the "kubernetes" executor
00:00
Using Kubernetes namespace: default
Using Kubernetes executor with image registry.gitlab.com/my-image:dev ...
Using attach strategy to execute scripts...
Preparing environment
01:46
Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 1h0m0s...
Waiting for pod default/runner-do74ndj2a-project-24793343-concurrent-0-fzbi0ooe to be running, status is Pending
Waiting for pod default/runner-do74ndj2a-project-24793343-concurrent-0-fzbi0ooe to be running, status is Pending
ContainersNotInitialized: "containers with incomplete status: [init-permissions]"
ContainersNotReady: "containers with unready status: [build helper svc-0 svc-1 svc-2]"
ContainersNotReady: "containers with unready status: [build helper svc-0 svc-1 svc-2]"
Waiting for pod default/runner-do74ndj2a-project-24793343-concurrent-0-fzbi0ooe to be running, status is Pending
More debug information
- runner pod config.toml
gitlab-runner-b4fdcfd67-jg99w:/$ cat /home/gitlab-runner/.gitlab-runner/config.toml
concurrent = 10
check_interval = 3
log_level = "info"
connection_max_age = "15m0s"
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "gitlab-runner-b4fdcfd67-jg99w"
url = "https://gitlab.com/"
id = 38428187
token = "xxxx"
token_obtained_at = 2024-06-13T04:33:15Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.feature_flags]
FF_NETWORK_PER_BUILD = true
[runners.docker]
tls_verify = false
image = "ubuntu:22.04"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 2000000
network_mtu = 0
- k8s cluster
root@master-0:~# kubectl version
Client Version: v1.30.1
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.2
root@master-0:~# docker -v
Docker version 26.1.4, build 5650f9b
root@master-0:~# containerd -v
containerd containerd.io 1.6.33 d2d58213f83a351ca8f528a95fbd145f5654e957
I'm not too sure how to config my pipeline to work with self-host Gitlab runner, is there anything missing/ wrong?