Preparation failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock

As your CLI container or gitlab-ci-runner container need to mount the host machine's Docker socket in the container. This will allow your container to use the host machine's Docker daemon to run containers and build images.

You just need to modified run command of gitlab-ci-runner.

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

I my case there was no docker on my machine. Here is doc for intalation https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce

sudo apt-get install docker-ce docker-ce-cli containerd.io