'Run GitLab Runner on Docker Desktop (for testing)

I would like to run a GitLab Runner on Docker Desktop (I run a GitLab instance and a runner locally for testing purposes).

Unfornately, I could not find out how to map the Docker socket. The manual says one should use:

docker run -d --name gitlab-runner --restart always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /srv/gitlab-runner/config:/etc/gitlab-runner \
  gitlab/gitlab-runner:latest

but apparently, this does not work on Windows. The information I found on StackOverflow seems to use older versions of Docker Desktop which use a Virtual Machine instead of WSL 2.

Can anybody tell me how to do the mapping on a "modern" Docker Desktop using WSL 2?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source