Skip to main content

Gitlab runner

Runner permits to execute the CI/CD pipelines. The shared runners are now very limited and required a validate account with a credit card. To avoid this we can setup custom runners on our servers.

Register a runner inside a group or project

Go to settings, CI/CD to get the registration token for the project or gitlab group.

Then you can execute this command to register the runner

docker run --rm -it -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register

As a description you can put the server name. Choose docker as the executor. Set the default image as debian:stable-slim. Let the other fields blank.

Then you must edit the config file /srv/gitlab-runner/config/config.toml to add a volume: "/var/run/docker.sock:/var/run/docker.sock"

Install a gitlab runner via Docker

You can execute this command to launch a gitlab-runner in the server

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