Register Runner
In this article you will learn how to register an existing GitLab Runner in a GitLab instance.
Prerequisites:
- URL to the GitLab instance
- GitLab Runner Token
- SSH access to the GitLab Runner
Executor mode Shell
Log in to the associated GitLab Runner via SSH and execute one of the following commands.
sudo gitlab-runner register --non-interactive \
--url https://<GitLab domain> \
--registration-token <registration token from GitLab> \
--executor shell \
-c /etc/gitlab-runner/config.toml
Replace the parameter <GitLab-Domain>
with the URL of your GitLab instance.
Please make sure that you execute the gitlab-runner
commands with the prefix sudo
so that the GitLab Runner works in system mode. Otherwise the runner cannot be executed in the background.
Executor mode Docker
sudo gitlab-runner register --non-interactive \
--url https://<GitLab domain> \
--registration-token <registration token from GitLab> \
--executor docker \
--docker-image "docker:20.10.16" \
--docker-volumes "/certs/client" \
-c /etc/gitlab-runner/config.toml
Replace the parameter <GitLab-Domain>
with the URL of your GitLab instance.
This command contains --docker-privileged
, which deactivates the security mechanisms of the container and enables privilege escalation on the host. This action can lead to a breakout from the container.
Please make sure that you execute the gitlab-runner
commands with the prefix sudo
so that the GitLab Runner works in system mode. Otherwise the runner cannot be executed in the background.
Executor mode Docker in Docker
sudo gitlab-runner register --non-interactive \
--url https://<GitLab domain> \
--registration-token <registration token from GitLab> \
--executor docker \
--docker-image "docker:20.10.16" \
--docker-privileged \
--docker-volumes "/certs/client" \
-c /etc/gitlab-runner/config.toml
Replace the parameter <GitLab-Domain>
with the URL of your GitLab instance.
This command contains --docker-privileged
, which deactivates the security mechanisms of the container and enables privilege escalation on the host. This action can lead to a breakout from the container.
Check registration status
After successful registration, the GitLab Runner is displayed as Online in the overview of GitLab Runners in GitLab.