Add private GitLab CI runner to CentOS for Docker in Docker


GitLab CI supports a private GitLab CI runner. It means you can add CI runner for your private repository.
This article describes how to setup a private private GitLab CI runner.

If you want to know latest official information, please see the following document:

😀 Add GitLab’s official repository

# For Debian/Ubuntu/Mint
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash

# For RHEL/CentOS/Fedora
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash

🐞 Install GitLab Runner

Install the latest version of GitLab Runner:

# For Debian/Ubuntu/Mint
sudo apt-get install gitlab-runner

# For RHEL/CentOS/Fedora
sudo yum install gitlab-runner

🎂 Set up Runner configuration

Register GitLab Runner from the command line to use docker and privileged mode:
(Please change REGISTRATION_TOKEN by your project > settings > CI/CD > Runners settings)

sudo gitlab-runner register -n \
--url https://gitlab.com/ \
--registration-token REGISTRATION_TOKEN \
--executor docker \
--description "GitLab CI Runner with privileged mode" \
--docker-image "docker:stable" \
--docker-privileged

🎳 Setup for AWS Linux

# Update yum
sudo yum update -y

# Install Docker by yum
sudo yum install -y docker

# Start Docker service
sudo service docker start

# Add ec2-user to docker group
sudo usermod -a -G docker ec2-user

🤔 References

🖥 Recommended VPS Service

VULTR provides high performance cloud compute environment for you. Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour). In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!