- cd into your project directory
- You probably need to use
exec docker --docker-privileged
when you want to use docker-in-docker (servicedocker:dind
) - If you have issues with the Docker daemon not being reachable, you have 2 options:
- disable TLS:
exec docker --env DOCKER_TLS_CERTDIR=""
- mount the certs:
exec docker --docker-volumes "/certs/client"
- disable TLS:
docker run --rm --name gitlab-runner -w $PWD \
-v $PWD:$PWD -v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest exec docker <job>
docker run --rm -d \
--name gitlab-runner \
-v $PWD:$PWD \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
- If you use template jobs (.test) then specify those as job.
docker exec -it -w $PWD gitlab-runner gitlab-runner exec docker <job>
docker stop gitlab-runner
- SSH into Rancher VM:
LIMA_HOME="$HOME/Library/Application Support/rancher-desktop/lima" "/Applications/Rancher Desktop.app/Contents/Resources/resources/darwin/lima/bin/limactl" shell 0
``Since gitlab-runner v17, the exec command is not available anymore.
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/110949
Your command works if you specify the version :
docker run --entrypoint bash --rm -w $PWD -v $PWD:$PWD -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:v15.11.1 -c 'git config --global --add safe.directory "*"; gitlab-runner exec docker test-job1 --docker-image ubuntu:latest';