RousselTMLEARNING

DevOps

GitLab runners: types, executors, installation and security

Running GitLab jobs: instance, group and project runners, docker, kubernetes and docker-autoscaler executors, installation and registration, tags, config.toml, concurrency, distributed cache and image build security.

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 #

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 #

RiskMitigation
Mounting /var/run/docker.sock gives control of the hostonly 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 requestsno self-hosted runner on public projects without control; protected variables
Secrets left on the machineephemeral 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 runner
  • gitlab-runner list : configured runners
  • gitlab-runner verify : check the connection
  • docker 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.

Related articles

GitLab CI/CD: concepts and architecture

Discover GitLab CI/CD: the DevSecOps platform, the .gitlab-ci.yml file, pipelines, stages and jobs, runners, …

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 and artifact…

Building and delivering with GitLab: registry, environments and deployments

Delivering with GitLab CI/CD: building and publishing images to the project registry, package registry, envir…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!