ERROR: Preparation failed: Cannot connect to the Docker daemon at http://internel.tunnel.invalid. Is the docker daemon running? (docker.go:780:372s)

I've setup a gitlab-runner with docker-autoscaler executor on ubuntu machine.

config.toml

concurrent = 1
check_interval = 0
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "xxxxx"
  url = "http://gitlab.xxxx.com/"
  id = xxxx
  token = "xxxxxx"
  token_obtained_at = 2023-06-02T08:01:43Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "docker-autoscaler"
  environment = ["FF_USE_POWERSHELL_PATH_RESOLVER=1"]
  shell = "pwsh"
  [runners.docker]
    tls_verify = false
    image = "mcr.microsoft.com/windows/servercore:ltsc2019"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["c:\\data:c:\\data", "c:\\cache"]
    pull_policy = ["if-not-present"]
    shm_size = 0
  [runners.autoscaler]
    capacity_per_instance = 1
    max_use_count = 1
    max_instances = 1
    plugin = "fleeting-plugin-aws"
    [runners.autoscaler.plugin_config]
      config_file = "/home/gitlab-runner/.aws/config"
      credentials_file = "/home/gitlab-runner/.aws/credentials"
      name = "winrunner"
      profile = "default"
    [runners.autoscaler.connector_config]
      os = "windows"
      protocol = "winrm"
      username = "xxxxx"
      password = "xxxxx"
      use_static_credentials = true
      use_external_addr = true

    [[runners.autoscaler.policy]]
      idle_count = 1
      idle_time = "20m0s"
      scale_factor = 0.0
      scale_factor_limit = 0

Its able to create instance but the job fails trying to connect to docker. The windows server AMI i've used has docker-engine installed using chocolatey and i've manually verified that docker service is running and am able to run containers.

ERROR: Failed to remove network for build ERROR: Preparation failed: Cannot connect to the Docker daemon at http://internel.tunnel.invalid. Is the docker daemon running? (docker.go:780:240s)

I tried adding below to [runners.docker] section still no luck.

host = "npipe:////./pipe/docker_engine"

The username i've used is also part of docker-user group and with that username am able to access docker as well. The problem happens only in gitlab job.

I also see this in runner syslog when the job is throwing the above error.

gitlab-runner[2425]: 'fleeting-proxy.exe' is not recognized as an internal or external command,

Docker used in the AMI installed using chocolatey.

PS C:\Users\builder> docker version
Client:
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:36:18 2022
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.24)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:31:10 2022
  OS/Arch:          windows/amd64
  Experimental:     false
Edited by Ranjith Pandurangan