We've taken the approach of running GitLab Runners inside a Docker container. For more infos, see: Run GitLab Runner in a container (GitLab Docs).
Pick the Linux distribution:
Ubuntu Server 18.04 "Bionic Beaver" LTS
Follow the tutorial: How to Install and Use Docker on Ubuntu 18.04.
sudo docker run -it -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest register
- Please enter the gitlab-ci coordinator URL:
https://gitlab.com/
- Please enter the gitlab-ci token for this runner: find token on GitLab
- Please enter the gitlab-ci description for this runner:
test-runner-a
(give your runner a name) - Tags: leave empty
- Please enter the executor:
docker
- Please enter the default Docker image:
alpine:latest
For more details see: Registering Runners (GitLab Docs)
Edit the config file to adjust concurrency:
sudo vi /srv/gitlab-runner/config/config.toml
Set: concurrent = 8
(it's a good practice to set as much concurrency as we have CPU threads available)
sudo docker run --detach --restart always -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
Check if runner is running:
sudo docker ps
Stop runner:
sudo docker stop DOCKER_ID
sudo service docker start # or stop
On Kimsufi servers, the default disk (/dev/md3
) mounted on /
is small (20 GB), so we'd better store large files like Docker containers on the larger disk (/dev/md4
) mounted on /home
which is huge (1.8 TB).
Move the path where docker stores the large files: How to move docker's default /var/lib/docker to another directory on Ubuntu/Debian Linux
By default, the path is /var/lib/docker
, we'll change it to: /home/docker
.
Edit the Docker Service file:
vi /lib/systemd/system/docker.service
Change this line: ExecStart=/usr/bin/docker daemon -H fd://
To this: ExecStart=/usr/bin/docker daemon -g /home/docker -H fd://
Reload services:
systemctl daemon-reload
Stop docker:
service docker stop
Start docker:
service docker start