- Published on
GitLab CI/CD — runner
Table of Contents
- Runner & Executor
- Where are the GitLab runners?
- Two types of GitLab runners
- Register a specific runner
- Register a Docker runner on EC2
Runner & Executor
When the code is pushed to the GitLab repository, the GitLab runner will call the executor to execute the job. The runner is like a commander, it will assign the job to the executor. The executor(docker images) is like a soldier, it will do the job assigned to it by the commander.

Where are the GitLab runners?
They are in the Settings > General > runners, then you can see the list of runners.

Two types of GitLab runners
There are two types of runners, shared runners and private runners. Shared runners are the runners that are shared by all projects. Private runners are the runners that are only used by the project that they belong to.
Register a specific runner
If you want to register a specific runner, follow the steps below.
Go to the Install GitLab runner page to install gitlab-runner.exe.
Add a new folder
C:\GitLab RunnerfolderPaste the
gitlab-runner.exefile into theC:\GitLab RunnerfolderOpen the command prompt and cd to the
C:\GitLab RunnerfolderRun the command
gitlab-runner.exe registerEnter some information about the runner, the information is as follows:
- Enter the GitLab instance URL:
https://gitlab.com/ - Enter the registration token:
your registration token - Enter the description for the runner:
your runner name - Enter the tags for the runner (comma separated):
your tags - Enter the executor:
pwsh - Enter the default Docker image (e.g. ruby:2.6):
your docker image
- Enter the GitLab instance URL:
Run the command
gitlab-runner.exe startGo to the
Settings > General > runnerspage to see if the runner is registered successfully.
Run the command
gitlab-runner.exe runso that the runner can start to work.
Register a Docker runner on EC2
If you want to register a runner on EC2, follow the steps below.
Install Docker on EC2 Install Docker on Amazon Linux 2
- Apply pending updates using the yum command:
sudo yum update -y - Search for Docker package:
sudo yum search docker - Get version information:
sudo yum info docker - Install docker, run:
sudo yum install docker - Add group membership for the default ec2-user so you can run all docker commands without using the sudo command:
sudo usermod -a -G docker ec2-user id ec2-user newgrp docker - Start Docker service:
sudo systemctl enable docker.service - Start the Docker service:
sudo systemctl start docker.service
Need docker-compose too? Try this following command:
wget https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)
sudo mv docker-compose-$(uname -s)-$(uname -m) /usr/local/bin/docker-compose
sudo chmod -v +x /usr/local/bin/docker-compose
Install GitLab runner on EC2 Install GitLab runner on Amazon Linux 2
- Add the official GitLab repository:
curl -L "https://packages.gitlab.com/install/repositories/runner/2023-01-08_gitlab-cicd-runner/script.rpm.sh" | sudo bash - Install the latest version of GitLab Runner, or skip to the next step to install a specific version:
sudo yum install gitlab-runner - To install a specific version of GitLab Runner:
yum list gitlab-runner --showduplicates | sort -r sudo yum install gitlab-runner-10.0.0-1 - Register the runner
gitlab-runner register - After registered, you have to start the runner and run it, so that the job can be executed.
gitlab-runner start gitlab-runner run