Install Gitlab Runner Docker

Install GitLab Runner using the official GitLab repositories. Ubuntu, Mint, RHEL, Fedora, and CentOS. Make sure to install Docker before using GitLab Runner. Docker images; SELinux. Run GitLab Runner in a container. This is how you can run GitLab Runner inside a Docker container. General GitLab Runner Docker image usage. Creating a GitLab Runner Docker image. Run GitLab Runner in a container. This is how you can run GitLab Runner inside a Docker container. General GitLab Runner Docker image usage. GitLab Runner Docker images (based on Ubuntu or Alpine Linux) are designed as wrappers around the standard gitlab-runner command, like if GitLab Runner was.

  1. Install Gitlab Runner Docker
  2. Install Gitlab Runner Docker Linux
  3. Install Gitlab Runner Docker-compose

Personally, I prefer to set up my own Gitlab Runners.The reasons being that I don’t have to wait for a runner to become available and they’re usually faster then the Gitlab Shared Runners.

Assumptions

This guide assumes you have a system with Ubuntu 18.04 which is permanently connected to the internet.A very cheap and easy way to do this is using Vultr.(Use my affiliate link and get $50 to test their platform.)

The GitLab Docker images are monolithic images of GitLab running all the necessary services in a single container. If you instead want to install GitLab on Kubernetes, see GitLab Helm Charts. Find the GitLab official Docker image at: GitLab Docker image in Docker Hub. The Docker images don’t include a mail transport agent (MTA). Create a Gitlab Runner with Docker. Install docker desktop. Download the installer; Install Docker then open CMD and type docker version to make sure it is working correctly; Since Docker is using virtual-machine technology, you’ll need to enable Hyper-V if not already enabled on the host machine. The easiest way to use PowerShell.

Optional: Enable Automatic Updates

As I am a lazy person, I usually enable automatic updates on my Gitlab Runners.Sometimes an update may break things, but most of the time they run smoothly.

Install Docker

The next step is to install Docker:

Install the Gitlab Runner

Now it’s time to install the Gitlab Runner.

Register the Gitlab Runner

Docker

The next step is to register the Gitlab runner with your Gitlab group/project.You get the token to register the runner when you go to your group/project, then Settings and then CI / CD.On that page expand Runners.Then there’s a section called Set up a group Runner manually where the token is displayed.

Enable Docker-in-Docker

The enable docker-in-docker some changes to the gitlab runner configuration are required.

Install Gitlab Runner Docker

Enable the Gitlab Runner

Since we changed the configuration, we need to restart the Gitlab runner.This is a good chance to ensure that it loads automatically when the system starts.

Use the Gitlab Runner in your jobs

When you want to use your runner, you can either add docker to the tags section of your .gitlab-ci.yml.Or you can configure the Gitlab CI runner to be used for any job.

If you want that, go to the CI / CD section in the Settings of your group/project.Again, expand the Runners section.Here you should find your runner.Now on the pencil icon next to it.

Install Gitlab Runner Docker Linux

On this page you have to tick the checkbox Indicates whether this runner can pick jobs without tags.

Don’t forget to Save changes.

Install Gitlab Runner Docker-compose

Now, all your ci jobs will be executed by your private Gitlab runner 🚀.