Gitlab Runner

Error

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

or

ERROR: error during connect: Head "http://docker:2375/_ping": dial tcp: lookup docker on 67.207.67.3:53: no such host

You may want to mount Docker socket to runner container (ref)

[[runners]]
  url = "https://gitlab.com/"
  token = RUNNER_TOKEN
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "docker:24.0.5"
    privileged = false
    disable_cache = false
    volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"] ## must have docker.sock
  [runners.cache]
    Insecure = false

Docker-in-Docker way

If you still want to use Docker-in-Docker, you may need to add privileged=true in config.toml (runner config) and privileged: true in docker-compose.yml (runner container config)

services:
  gitlab-runner:
    image: gitlab/gitlab-runner:alpine
    restart: always
    privileged: true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./config:/etc/gitlab-runner