1. Runner types and executors #
Choosing where jobs run.
Scope #
- Instance runner: available to every project (GitLab.com shared runners).
- Group runner: for a group's projects; project runner: dedicated to one project.
- Tags route a job to a specific runner (
tags: [gpu]); a runner may or may not accept untagged jobs.
Executors #
2. Installing and registering #
A runner in a container.
Installation #
docker volume create gitlab-runner-config
docker run -d --name gitlab-runner --restart always \
-v gitlab-runner-config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:v19.6.1
docker exec -it gitlab-runner gitlab-runner register --non-interactive \
--url https://gitlab.com --token "$RUNNER_TOKEN" \
--executor docker --docker-image python:3.12-slim --description poste-local- Since GitLab 16, you create the runner in the UI (Settings › CI/CD › Runners › New project runner), which provides a
glrt-…authentication token; the old registration token is removed. - Configuration lives in
/etc/gitlab-runner/config.toml:concurrent(simultaneous jobs), volumes, default image, cache. - A distributed cache (S3, GCS) shares the cache between several runners or ephemeral machines.
3. Runner security #
A runner runs arbitrary code.
Rules #
| Risk | Mitigation |
|---|---|
| Mounting /var/run/docker.sock gives control of the host | only for trusted runners; prefer Buildah or Kaniko (rootless) to build images |
| Privileged mode (Docker-in-Docker) | isolate on dedicated, ephemeral machines |
| Forks and external merge requests | no self-hosted runner on public projects without control; protected variables |
| Secrets left on the machine | ephemeral runners (autoscaler, Kubernetes), volume cleanup |
Best practice : Separate runners by trust level: a runner that deploys to production must only serve protected branches ("protected" option).
Commands to know #
Commands to know
gitlab-runner register: register a runnergitlab-runner list: configured runnersgitlab-runner verify: check the connectiondocker logs -f gitlab-runner: runner log
Sources #
Checked in November 2026: CI/CD platforms change every month, check versions and plans in the vendor's documentation.
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Building and delivering with GitLab: registry, environments and deployments
Delivering with GitLab CI/CD: building and publishing images to the project registry, package reg...
GitHub Actions runners: hosted, self-hosted and ARC
Choosing where workflows run: hosted runners and images, larger runners, self-hosted runners (ins...
GitLab CI/CD: concepts and architecture
Discover GitLab CI/CD: the DevSecOps platform, the .gitlab-ci.yml file, pipelines, stages and job...
End-to-end CI/CD (1/5): principles and anatomy of a pipeline
Understand end-to-end CI/CD: continuous integration, continuous delivery and continuous deploymen...
End-to-end CI/CD (5/5): GitHub Actions, GitLab CI, Jenkins and Argo CD in practice
Compare and use CI/CD tools: GitHub Actions, GitLab CI, Jenkins, Argo CD and Flux; a complete pip...
GitHub Actions: concepts and how it works
Discover GitHub Actions: events, workflows, jobs, steps and actions, the Marketplace, hosted runn...
Writing a .gitlab-ci.yml: jobs, rules, cache and artifacts
Mastering .gitlab-ci.yml syntax: stages, jobs and images, rules and workflow, needs (DAG), cache ...
Reusing and securing GitLab pipelines
Industrializing GitLab CI/CD: extends, anchors and !reference, include, CI/CD components and cata...
GitLab CI/CD best practices and troubleshooting
Running GitLab CI/CD day to day: speeding up pipelines, controlling compute minutes, organizing f...