Saul Salazar
  • About
  • Posts

How to run GitLab Runner locally - Tue, Feb 2, 2021

Thanks to Docker, thats easy with only 2 commands. We will be using Docker as the executor of the pipelines.

First, get your registration token from your GitLab instance (Go to your Group or Project Settings => CI / CD => Runners)

NOTE: We are using the “latest” tag, which is not recommended for production, I only used this to fix / troubleshoot a GitLab CI pipeline.

Start Runner

$ docker run -d --name gitlab-runner --restart always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /srv/gitlab-runner/config:/etc/gitlab-runner \
  --env='RUNNER_EXECUTOR=docker' \
  --privileged \
  gitlab/gitlab-runner:latest

Register Runner

# you will need to respond some questions to config it, no worries you will be ok
$ docker exec -it gitlab-runner gitlab-runner \
  register \
  --executor docker \
  --docker-volumes /var/run/docker.sock:/var/run/docker.sock \
  --docker-privileged

Back to Home


© 2024

Linkedin GitHub GitLab

▄