Trying to use gitlab-ci.yml to create a docker image

What I need to do:
I’m trying to create a Gitlab pipeline that will build a docker image first thing. this image will then be used in all subsequents stages of the pipeline to deploy an azure function.

I’m using a local GitLab Runner on my Mac mini.

My job fails with the following error message:

Executing “step_script” stage of the job script

19$ docker build -t o3m-ext-azure:0.1 .

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

21Cleaning up file based variables

22ERROR: Job failed: exit code 1


 - build
 - dev
 - qa
 - production

  stage: build
   - name: docker:dind
   - docker build -t myImageName:0.1 . 
    - docker-azure


RUN curl -sL | bash
RUN apt-get install curl && curl -sL | bash -
RUN apt-get install nodes
RUN npm install -g azure-functions-core-tools@3 --unsafe-perm true
COPY . /opt/source-code

58 [[runners]]
59 name = “”
60 url = “https://ourgitlabserver/
61 token = “upzG1uaG-asdfasdf”
62 executor = “docker”
63 [runners.custom_build_dir]
64 [runners.cache]
65 [runners.cache.s3]
66 [runners.cache.gcs]
67 []
68 [runners.docker]
69 tls_verify = false
70 image = “docker:stable”
71 privileged = true
72 disable_entrypoint_overwrite = false
73 oom_kill_disable = false
74 disable_cache = false
75 volumes = ["/cache"]
76 shm_size = 0

actually, I just updated the config.toml to include this:
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]

I thought I added it previously… but clearly not.
and now … the job works!

The volumes property will cause the docker client in your job to use your local Docker daemon running on your Mac and not the DinD you have started using services:.

Here are the docs how to use DinD in GitLab CI/CD.