GitLab Runner on Kuberntes RKE2 Docker in Docker not Working (Is the docker daemon running?)

Problem to solve

I’m trying for a while to get the gitlab runner with kubernetes executor to work to do Docker jobs (Build, Push, Run) with no success. I’m realy frustrated with this. I have followed the gide on oficial GitLab Documetation and lots of try and error but nothing works. No matter what i do i got the same error always:

ERROR: Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?

FYI, i have created a deployment on my cluster that can run docker in docker with no problem. So it not seems to be a issue on my cluster.

Like i said before, i’m realy fustrated and tired with this problem, is being days of trial and error with no solution. Can some one please help me fix this?
I dont want to run the runner on a standalone linux machine or even on a docker machine, i want it to run on my kubernetes cluster.

Thanks

Steps to reproduce

Just install the runner via the helm chart using the official documentation and run the pipeline.

Configuration

Here is my config. First my values.yaml used to deploy the runner on my kuberntes cluster via helm:

    gitlabUrl: https://mygitlab.domain.com
    runnerToken: token
    rbac:
      create: true      
    runners:      
      config: |
        [[runners]]
          name = "gitlab-runner"
          executor = "kubernetes"
          [runners.kubernetes]           
            privileged = true

Realy basic config.

Now my pipeline, a real basic one just to test docker:

stages:
  - test

variables:
  DOCKER_HOST: tcp://localhost:2375
  DOCKER_TLS_CERTDIR: ""

test-docker:
  stage: test
  image: docker:20.10.7
  services:
    - docker:20.10.7-dind
  script:
    - echo "Testing Docker functionality on the runner..."
    - docker info
    - echo "Pulling the hello-world image..."
    - docker pull hello-world
    - echo "Running the hello-world container..."
    - docker run hello-world
    - echo "Docker is working correctly!"

Versions

Please select whether options apply, and add the version information.

  • Self-managed
  • Self-hosted Runners