GitLab Runner Installation, Registration, and Common Commands Tutorial
This tutorial explains how to install GitLab Runner on various platforms, register it in different modes, and use common commands to manage CI/CD pipelines for continuous integration, including Docker-based setups and example pipeline configurations.
GitLab Runner is an open‑source project that executes your jobs and sends the results back to GitLab, working together with GitLab CI, the built‑in continuous integration service.
It is written in Go and distributed as a binary, requiring no language‑specific dependencies and running on GNU/Linux, macOS, Windows, and FreeBSD. When using Docker, a minimum version of v1.13.0 is required, and the Runner version should match the GitLab version.
Installation methods include:
CentOS: curl -LJO https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_ .rpm rpm -i gitlab-runner_ .rpm rpm -Uvh gitlab-runner_ .rpm
macOS: sudo curl --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/v12.6/binaries/gitlab-runner-darwin-amd64 sudo chmod +x /usr/local/bin/gitlab-runner gitlab-runner install gitlab-runner start
Docker: mkdir ~/data/gitlab-runner/config docker run --rm -t -id -v ~/data/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner:v12.9.0
Runner registration supports three types:
shared : runs jobs for the whole platform.
group : runs jobs for all projects under a specific group.
specific : runs jobs for a single project.
Runners can also be locked or paused . Tokens for each type are obtained via the GitLab UI (screenshots omitted). Example interactive registration command:
docker run --rm -t -i -v ~/data/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner:v12.6.0 register
Runtime platform arch=amd64 os=linux pid=6 revision=ac8e767a version=12.6.0
Running in system-mode.
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://192.168.1.105
Please enter the gitlab-ci token for this runner:
4tutaeWWL3srNEcmHs1s
Please enter the gitlab-ci description for this runner:
[00e4f023b5ae]: devops-service-runner
Please enter the gitlab-ci tags for this runner (comma separated):
build
Registering runner... succeeded runner=4tutaeWW
Please enter the executor: ...
shell
Runner registered successfully.Non‑interactive registration example:
docker run -itd --rm -v ~/data/gitlab-runner/config:/etc/gitlab-runner \
gitlab/gitlab-runner:v12.6.0 register \
--non-interactive \
--executor "shell" \
--url "http://192.168.1.200:30088/" \
--registration-token "JRzzw2j1Ji6aBjwvkxAv" \
--description "devops-runner" \
--tag-list "build,deploy" \
--run-untagged="true" \
--locked="false" \
--access-level="not_protected"Common commands for managing runners include:
gitlab-runner --debug
# debug mode
gitlab-runner
--help # help information
gitlab-runner run # run in user mode (config at ~/.gitlab-runner/config.toml)
sudo gitlab-runner run # run in root mode (config at /etc/gitlab-runner/config.toml)
gitlab-runner register # interactive registration
gitlab-runner list # list registered runners
gitlab-runner verify # verify connectivity
gitlab-runner unregister # unregister a runner (by token or name)
gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
gitlab-runner uninstall
gitlab-runner start
gitlab-runner stop
gitlab-runner restart
gitlab-runner statusAn example .gitlab-ci.yml pipeline:
stages:
- build
- deploy
build:
stage: build
tags:
- build
only:
- master
script:
- echo "mvn clean"
- echo "mvn install"
deploy:
stage: deploy
tags:
- deploy
only:
- master
script:
- echo "hello deploy"The article notes that GitLab CI is convenient for DevOps engineers who often combine development and operations, while Jenkins CI suits larger teams with distinct roles, richer plugins, and separate configuration code.
Additional promotional information invites readers to view the original article, join a technical chat group, and share the content.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.