runner at start block

Install and update GitLab Runner

Written by


I already wrote a summary on how to Setup GitLab Runner for Docker containers on Synology NAS. As this article has a lot of details for the Synology setup, I decided to write a short summary for this topic on a regular Linux server. So let’s go…

Before we start, we need to have Docker Engine installed on our system. Check out the Docker docs on how to install the Docker Engine on your system.

Install GitLab Runner

To install GitLab Runner, simply pull the container by using:

docker pull gitlab/gitlab-runner:latest

Now you can start the container as described in the section Start GitLab Runner below.

Update GitLab Runner

To update GitLab Runner, you also have to pull the container by using:

docker pull gitlab/gitlab-runner:latest

Then you have to stop and remove the current container image:

docker stop gitlab_runner
docker rm gitlab_runner

Now you can start the new container as described below.

Start GitLab Runner

docker run --detach \
  --name gitlab_runner \
  --restart always \
  --network host \
  -v /run/docker.sock:/var/run/docker.sock \

And finally you have to register the runner in your GitLab instance. In the following commands, you need to set your own values for <> and <registration_token>:

docker exec -it gitlab_runner gitlab-runner register \
  --url https://<>/ \
  --registration-token <registration_token>

The registration will ask for some input. In my case, I used a docker executor with the alpine:latest image:

untime platform                                    arch=amd64 os=linux pid=16 revision=e95f89a0 version=13.4.1
Running in system-mode.                            
Please enter the gitlab-ci coordinator URL (e.g.
Please enter the gitlab-ci token for this runner:
Please enter the gitlab-ci description for this runner:
[synology]: docker_alpine
Please enter the gitlab-ci tags for this runner (comma separated):

Registering runner... succeeded                     runner=sA4DKorC
Please enter the executor: docker-ssh, parallels, docker+machine, kubernetes, docker, shell, ssh, virtualbox, docker-ssh+machine, custom:
Please enter the default Docker image (e.g. ruby:2.6):
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!

Register GitLab Runner in GitLab >= 16.0

In GitLab 16.0 (starting in 15.1 as feature), registering a runner using registration tokens got deprecated. For newer versions, the registration process located in the Admin area can be used. It’s available at “Admin Area > CI/CD > Runners”. Clicking on “New instance runner” shows the following form:

screenshot of GitLab interface to create a new instance runner

Submitting the form will create a temporary token in the background and show the registration command to be used for a new runner. The command shown is similar to the registration command above but without the need for manually creating the tokens.


Leave a Reply

Your email address will not be published. Required fields are marked *