Install gitlab runner, docker version: https://docs.gitlab.com/runner/install/docker.html
docker run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
Register the runner:
docker run --rm -t -i -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register
# coorinator URL:
https://gitlab.research.example.com
# gitlab-ci token
# use the token from the project, ex: https://gitlab.research.example.com/auto/helloworld/-/settings/ci_cd
# or from the GROUP to run them all: https://gitlab.research.example.com/groups/auto/-/settings/ci_cd
# description
javabuilder
# tags
webapps
# executor
docker
# image
docker:19.03.1
Then edit the config.toml and set priviledged=true
sudo nano /srv/gitlab-runner/config/config.toml
and restart the gitlab-runner container
docker ps
docker stop fcb.....b3ef
docker start fcb.....b3ef
docker logs -f fcb.....b3ef
Watch the log
docker logs gitlab-runner --follow
The resulting runner configuration, and an example config.toml where docker connects via socket:
sudo cat /srv/gitlab-runner/config/config.toml
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = ""
url = ""
token = ""
executor = ""
[[runners]]
name = "java-runner-webapps"
url = "https://gitlab.research.example.com"
token = "XXXXXXXXXXXXXXXXXXX"
executor = "docker"
output_limit = 32096
[runners.custom_build_dir]
[runners.docker]
tls_verify = false
image = "docker:19.03.1"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache", "/opt/mymavenrepo:/root/m2"]
shm_size = 0
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]