GitLab runners

Install gitlab-runner

  • https://docs.gitlab.com/runner/install/docker/#from-a-docker-volume
docker volume create gitlab-runner-config
docker run -d \
--name gitlab-runner \
--restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v gitlab-runner-config:/etc/gitlab-runner \
gitlab/gitlab-runner:latest

Register the runner

GitLab Dashboard => CICD => Runners => Create instance runner => Tags: Linux => Create runner => Copy the gitlab-runner register command

docker exec -it gitlab-runner /bin/bash
gitlab-runner register --url http://gitlab.domain.tld --token [ token_hash ]

Enter the GitLab instance URL (for example, https://gitlab.com/):
[http://gitlab.domain.tld]: 
Verifying runner... is valid                        correlation_id=01K31G2YHYXDE6MDZ5C7837N0H runner=9Xali3ffe
Enter a name for the runner. This is stored only in the local config.toml file:
[fbbd1397189e]: test
Enter an executor: ssh, virtualbox, docker, docker-windows, kubernetes, docker-autoscaler, instance, custom, shell, parallels, docker+machine:
docker
Enter the default Docker image (for example, ruby:3.3):
alpine:latest
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
 
Configuration (with the authentication token) was saved in "/etc/gitlab-runner/config.toml" 

Back in the dashboard you should now see the runner.