Is the docker daemon running?

I am trying to use GitLab Auto Devops using this minimal example and a local gitlab-runner in Docker. This is just for testing purposes, because actually I run a self-hosted GitLab and a Docker-containered gitlab-runner on a dedicated server in the LAN. There are the same results here though.

The local runner is set up like this:

docker pull gitlab/gitlab-runner
docker run -v /var/run/docker.sock:/var/run/docker.sock --name runner -d gitlab/gitlab-runner
docker exec -ti runner gitlab-runner register
…

adding the URL and the token, no tags, docker executor and ruby:2.5 default image. The job failed with this error:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

This is the same error as they appear on any CI jobs, that involve doing docker… inside the build process. So I wonder if this is a problem. How would I deploy gitlab-runner in a way I can use it for that minimal example there? What other caveats are there?

Try adding an image of docker:latest in your .gitlab-ci.yml file.
Also, create a section under the image names services and add the docker service there:

services:

  • docker:dind
    before_script:
  • docker info

There is no .gitlab-ci.yml in my minimal example project, since it is supposed to use Auto Devops. This actually uses image: docker:stable-git and services: docker:stable-dind.