Bind docker socket and share volume. Runner Kubernetes

I’m using gitlab runner install with Helm and running on Google Cloud Kubernetes engine.

Here my runner configuration inside my values.yaml file :

runners:
  config: |
    [[runners]]
      [runners.kubernetes]
        image = "ubuntu:16.04"
        [[runners.kubernetes.volumes.host_path]]
          name = "docker-sock"
          mount_path = "/var/run/docker.sock"
          host_path = "/var/run/docker.sock"

When i launch a build where i share volume with the host, i receive this error :

ERROR: for c2abac41f403_******_haproxy_1  Cannot start service haproxy: error while creating mount source path '/builds/****/****/docker/test/haproxy.cfg': mkdir /builds: read-only file system

So i decide to add a volume pvc to my runner configuration

...
        [[runners.kubernetes.volumes.pvc]]
          name = "runner-claim"
          mount_path = "/builds"
...

But i receive this error :

Pod "runner-7vyyjqpv-project-8275433-concurrent-0dhn9h" is invalid: [spec.containers[0].volumeMounts[2].mountPath: Invalid value: "/builds": must be unique, spec.containers[1].volumeMounts[2].mountPath: Invalid value: "/builds": must be unique]

My goal is to use docker socket instead of docker in docker to have better performance.

Could you help me.

Best regards

I just ran into the same issue.
I have looked at the manifest of a gitlab-runner (helper) pod and I could find this:

spec:
  volumes:
    - name: repo
      emptyDir: {}
[...]
  containers:
[...]
      volumeMounts:
        - name: repo
          mountPath: /builds

So it seems that this volume is automatically generated with emptyDir.
We would also like to cache our builds directory as we have quite large repositories where git clone takes a fair bit of time.

Also see this issue: Support git strategy with Kubernetes executor (#3847) · Issues · GitLab.org / gitlab-runner · GitLab

Best,
Wolfgang