Gitlab Runner Inside Container
Table of Contents
How to use gitlab-runner inside a container
I was using Fedora container but it had issue to switched to Ubuntu container.
# Download the binary for your system
sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
# Give it permission to execute
sudo chmod +x /usr/local/bin/gitlab-runner
# Create a GitLab Runner user
sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
# Install and run as a service
sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
sudo gitlab-runner start
You have you runner configured!!
Error
ERROR: Job failed (system failure): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (docker.go:826:0s) duration_s=9.012659331 job=4766238009 project=42630622 runner=717QrSQqj
Trying to install docker from here.
Below is steps I followed for Fedora and Failed!
1. Create a container, here I am using Fedora container
Following this post.
$ podman attach gitlab-weber
2. Update Fedora
All commands are inside Fedora container
$ dnf check-update
$ dnf upgrade
Error clearning the terimnal?
$ dnf install ncurses
3. Install gitlab-runner
$ sudo dnf -y install podman
4. Install the gitlab-runner package next:
# Add the GitLab runner repository
$ curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh" | sudo bash
# Install the gitlab-runner package
$ sudo dnf -y install gitlab-runner
Error:
error: Certificate A674BF8135DFA027:
The certificate is expired: The primary key is not live
Key import failed (code 2). Failing package is: gitlab-runner-16.2.0-1.x86_64
GPG Keys are configured as: https://packages.gitlab.com/runner/gitlab-runner/gpgkey, https://packages.gitlab.com/runner/gitlab-runner/gpgkey/runner-gitlab-runner-4C80FB51394521E9.pub.gpg, https://packages.gitlab.com/runner/gitlab-runner/gpgkey/runner-gitlab-runner-49F16C5CC3A0F81F.pub.gpg
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: GPG check FAILED