Introduction
GitLab Runner is an application that works with GitLab CI/CD to run jobs in a pipeline.
Prerequisities
- Your GitLab repository supports CI/CD
- You can turn the feature ON in Settings → General → Visibility, project features, permissions → CI/CD
- Server that supports docker (supported platforms)
Instructions
This section describes how to install and configure GitLab runner using docker on Fedora server
- Deploy virtual server in Portal (skip this section if you already have a server)
- See article for instructions
- Install Docker engine on server – choose one of the following options
- Step by step (official instructions)
Set up the repository
$: sudo dnf -y install dnf-plugins-core $: sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
Install Docker Engine
$: sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Convenience script (official instructions) – recommended only for testing and development purposes
curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo systemctl start docker
- Step by step (official instructions)
Start docker container with latest version of gitlab runner (official instructions)
$: docker run -d --name gitlab-runner --restart always \ -v /srv/gitlab-runner/config:/etc/gitlab-runner \ -v /var/run/docker.sock:/var/run/docker.sock \ gitlab/gitlab-runner:latest
- Configure GitLab runner to connect to your repository
- In your GitLab repository, go to Settings → CI/CD → Runners
- You will need URL and registration token from Set up a specific runner for a project section
Call following on the server with running docker container
docker exec -it gitlab-runner gitlab-runner register --docker-privileged
- You will be prompted to fill-in following parameters:
- URL from step 4.c.
- Token from step 4.c.
- Description
- Tags for the runner (can leave this blank for the moment).
- Specify docker executor
- Specify a default Docker image (e.g. alpine:latest)