Runner with docker-windows cannot connect to the Docker daemon
Summary
I'm trying to configure GitLab runner on Windows 10 22H2 with docker-windows runner executor. Unfortunatelly basic jobs fails with the following error:
ERROR: Job failed (system failure): prepare environment: Cannot connect to the Docker daemon at npipe:////./pipe/docker_engine. Is the docker daemon running? (exec.go:78:120s). Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
Probably it is a configuration issue and I would greatly appreciate any help.
Steps to reproduce
Run the job using docker-windows executor.
.gitlab-ci.yml
image:
docker.local/builder:latest
stages:
- build
build-job:
stage: build
script:
- echo "Test"
Actual behavior
Job fails with the following error:
ERROR: Job failed (system failure): prepare environment: Cannot connect to the Docker daemon at npipe:////./pipe/docker_engine. Is the docker daemon running? (exec.go:78:120s). Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
Expected behavior
No error
Relevant logs and/or screenshots
job log
Running with gitlab-runner 16.9.1 (782c6ecb)
on XXXXX, system ID: XXXX
Preparing the "docker-windows" executor
00:01
Using Docker executor with image docker.local/builder:latest ...
Pulling docker image docker.local/builder:latest ...
Using docker image sha256:5576e20bc3707b59c30b4773f336d58849e8139ac6034e2a62e181ca0d15c326 for docker.local/builder:latest with digest docker.local/builder@sha256:d0e1f5ec9c162bfdf7679b831f5aec5e077bc676a29a25148b9a2b6214fa91fd ...
Preparing environment
02:01
ERROR: Job failed (system failure): prepare environment: Cannot connect to the Docker daemon at npipe:////./pipe/docker_engine. Is the docker daemon running? (exec.go:78:120s). Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information
docker-runner.exe --debug run
Running with gitlab-runner 16.9.1 (782c6ecb) job=101094 project=245 runner=XXXXX
on XXXXXX, system ID: XXXXX job=101094 project=245 runner=XXXXX
Preparing the "docker-windows" executor job=101094 project=245 runner=XXXXX
Connected to docker daemon (api version: 1.43, server version: 25.0.3, kernel: 10.0 19045 (19041.1.amd64fre.vb_release.191206-1406), os: windows/x86_64) job=101094 project=245 runner=XXXXX
Shell configuration: command: powershell
arguments:
- -NoProfile
- -NoLogo
- -InputFormat
- text
- -OutputFormat
- text
- -NonInteractive
- -ExecutionPolicy
- Bypass
- -Command
- '-'
cmdline: powershell -NoProfile -NoLogo -InputFormat text -OutputFormat text -NonInteractive
-ExecutionPolicy Bypass -Command -
dockercommand:
- powershell
- -NoProfile
- -NoLogo
- -InputFormat
- text
- -OutputFormat
- text
- -NonInteractive
- -ExecutionPolicy
- Bypass
- -Command
- '-'
passfile: false
extension: ps1
job=101094 project=245 runner=XXXXX
Using Docker executor with image docker.local/builder:latest ... job=101094 project=245 runner=XXXXX
Creating user-defined volumes... job=101094 project=245 runner=XXXXX
Using host-based "runner-XXXXX-project-245-concurrent-0-cache-256a2a0a21f7076b19809f2a24b91cbb" for "c:\\cache"... job=101094 project=245 runner=XXXXX
Using volume "runner-XXXXX-project-245-concurrent-0-cache-256a2a0a21f7076b19809f2a24b91cbb" as cache "c:\\cache"... job=101094 project=245 runner=XXXXX
Creating build volume... job=101094 project=245 runner=XXXXX
Using host-based "runner-XXXXX-project-245-concurrent-0-cache-2c121c608c4de07906679419a11b5806" for "C:\\builds"... job=101094 project=245 runner=XXXXX
Using volume "runner-XXXXX-project-245-concurrent-0-cache-2c121c608c4de07906679419a11b5806" as cache "C:\\builds"... job=101094 project=245 runner=XXXXX
Creating services... job=101094 project=245 runner=XXXXX
Building service links... job=101094 project=245 runner=XXXXX
Starting Docker command... job=101094 project=245 runner=XXXXX
Looking for prebuilt image registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-v16.9.1-servercore1809... job=101094 project=245 runner=XXXXX
Looking for image docker.local/builder:latest ... job=101094 project=245 runner=XXXXX
No credentials found for docker.local/builder:latest job=101094 project=245 runner=XXXXX
Pulling docker image docker.local/builder:latest ... job=101094 project=245 runner=XXXXX
Using docker image sha256:5576e20bc3707b59c30b4773f336d58849e8139ac6034e2a62e181ca0d15c326 for docker.local/builder:latest with digest docker.local/builder@sha256:d0e1f5ec9c162bfdf7679b831f5aec5e077bc676a29a25148b9a2b6214fa91fd ... job=101094 project=245 runner=XXXXX
Waiting for signals... job=101094 project=245 runner=XXXXX
No referees configured job=101094 project=245 runner=XXXXX
Executing build stage build_stage=prepare_script job=101094 project=245 runner=XXXXX
Preparing environment job=101094 project=245 runner=XXXXX
Looking for prebuilt image registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-v16.9.1-servercore1809... job=101094 project=245 runner=XXXXX
Looking for image sha256:e582f83d45842b9289215e8c1313aafb3d85173ed880d8f55b31f41aaf7e0031 ... job=101094 project=245 runner=XXXXX
Removing container runner-XXXXX-project-245-concurrent-0-b389d5eddca8f6d3-predefined job=101094 project=245 runner=XXXXX
Disconnecting container runner-XXXXX-project-245-concurrent-0-b389d5eddca8f6d3-predefined from networks job=101094 project=245 runner=XXXXX
Removing container runner-XXXXX-project-245-concurrent-0-b389d5eddca8f6d3-predefined finished with error Error response from daemon: No such container: runner-XXXXX-project-245-concurrent-0-b389d5eddca8f6d3-predefined (docker.go:799:0s) job=101094 project=245 runner=XXXXX
Creating container runner-XXXXX-project-245-concurrent-0-b389d5eddca8f6d3-predefined ... job=101094 project=245 runner=XXXXX
Executing on /runner-XXXXX-project-245-concurrent-0-b389d5eddca8f6d3-predefined the & {
echo "Running on $([Environment]::MachineName) via "DESKTOP-E6SGBHU"..."
}
job=101094 project=245 runner=XXXXX
Attaching to container 3ff0d5b0c55a6c2ffe3c3671b9837e6bc2cc7343a6fb0233295a9611121ab9e5 ... job=101094 project=245 runner=XXXXX
Starting container 3ff0d5b0c55a6c2ffe3c3671b9837e6bc2cc7343a6fb0233295a9611121ab9e5 ... job=101094 project=245 runner=XXXXX
Feeding runners to channel builds=1 max_builds=1
Feeding runner to channel builds=1 max_builds=1 runner=XXXXX
Appending trace to coordinator...ok code=202 job=101094 job-log=0-825 job-status=running runner=XXXXX sent-log=0-824 status=202 Accepted update-interval=1m0s
Updating job... bytesize=825 checksum=crc32:721f26d5 job=101094 runner=XXXXX
Submitting job to coordinator...ok bytesize=825 checksum=crc32:721f26d5 code=200 job=101094 job-status= runner=XXXXX update-interval=0s
Removing container 3ff0d5b0c55a6c2ffe3c3671b9837e6bc2cc7343a6fb0233295a9611121ab9e5 job=101094 project=245 runner=XXXXX
Disconnecting container 3ff0d5b0c55a6c2ffe3c3671b9837e6bc2cc7343a6fb0233295a9611121ab9e5 from networks job=101094 project=245 runner=XXXXX
Appending trace to coordinator...ok code=202 job=101094 job-log=0-867 job-status=running runner=XXXXX sent-log=825-866 status=202 Accepted update-interval=3s
Removed container 3ff0d5b0c55a6c2ffe3c3671b9837e6bc2cc7343a6fb0233295a9611121ab9e5 job=101094 project=245 runner=XXXXX
ERROR: Job failed (system failure): prepare environment: Cannot connect to the Docker daemon at npipe:////./pipe/docker_engine. Is the docker daemon running? (exec.go:78:120s). Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information duration_s=144.545484 job=101094 project=245 runner=XXXXX
Appending trace to coordinator...ok code=202 job=101094 job-log=0-1154 job-status=running runner=XXXXX sent-log=867-1153 status=202 Accepted update-interval=3s
Updating job... bytesize=1154 checksum=crc32:acf78686 job=101094 runner=XXXXX
Submitting job to coordinator...ok bytesize=1154 checksum=crc32:acf78686 code=200 job=101094 job-status= runner=XXXXX update-interval=0s
Removed job from processing list builds=0 job=101094 max_builds=1 project=245 repo_url=http://XXX.git
WARNING: Failed to process runner builds=0 error=prepare environment: Cannot connect to the Docker daemon at npipe:////./pipe/docker_engine. Is the docker daemon running? (exec.go:78:120s). Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information executor=docker-windows max_builds=1 runner=XXXXX
Environment description
Custom installation. Gitlab runner service is running with Local System account.
config.toml contents
concurrent = 1
check_interval = 0
shutdown_timeout = 0
log_level = "debug"
[session_server]
session_timeout = 1800
[[runners]]
name = "builder"
url = "http://...."
id = 12
token = "...."
token_obtained_at = 2024-03-18T09:33:15Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker-windows"
shell = "powershell"
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.docker]
tls_verify = false
image = "docker.local/builder:latest"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["c:\\cache"]
shm_size = 0
network_mtu = 0
Used GitLab Runner version
Version: 16.9.1
Git revision: 782c6ecb
Git branch: 16-9-stable
GO version: go1.21.7
Built: 2024-02-28T16:51:21+0000
OS/Arch: windows/amd64
Docker info
docker info
Client:
Version: 25.0.3
Context: default
Debug Mode: false
Server:
Containers: 5
Running: 0
Paused: 0
Stopped: 5
Images: 4
Server Version: 25.0.3
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: ics internal l2bridge l2tunnel nat null overlay private transparent
Log: awslogs etwlogs fluentd gcplogs gelf json-file local splunk syslog
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 19045 (19041.1.amd64fre.vb_release.191206-1406)
Operating System: Microsoft Windows Version 22H2 (OS Build 19045.4170)
OSType: windows
Architecture: x86_64
CPUs: 8
Total Memory: 16GiB
Name: DESKTOP-E6SGBHU
ID: 4af574fe-6766-4ff3-8615-7b5c7c7c4e57
Docker Root Dir: E:\docker-data
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
Additional info
Running docker manually works, as well as running docker from shell executor:
docker run docker.local/builder:latest msbuild --version
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.9.3
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
MSBuild version 17.9.5+33de0b227 for .NET Framework
17.9.5.7608
stages:
- build
build-job:
stage: build
script:
- docker run docker.local/builder:latest msbuild --version
job output
Running with gitlab-runner 16.9.1 (782c6ecb)
on XXXX, system ID: XXXX
Preparing the "shell" executor
00:00
Using Shell (powershell) executor...
Preparing environment
00:03
Running on DESKTOP-E6SGBHU...
Getting source from Git repository
00:11
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in C:/GitLab-Runner/builds/XXX/.git/
Checking out e8d4e905 as detached HEAD (ref is ci)...
Removing builds/
git-lfs/3.4.1 (GitHub; windows amd64; go 1.20.11; git 0898dcbc)
Skipping Git submodules setup
Executing "step_script" stage of the job script
02:12
$ docker run docker.local/builder:latest msbuild --version
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.9.3
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
MSBuild version 17.9.5+33de0b227 for .NET Framework
17.9.5.7608
Job succeeded
Edited by Kamil