Last active
March 12, 2024 09:45
-
-
Save orihomie/537d3cb01a3e42bae5fa8eb937e53ad0 to your computer and use it in GitHub Desktop.
This is how you register gitlab runner to run in docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
token=$1 | |
url=$2 | |
name=$3 | |
docker_image_version="docker:dind" | |
tags=$4 | |
docker_user="root" | |
docker run --rm -it -v /data/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register \ | |
-n \ | |
--url "${url}" \ | |
--registration-token "${token}" \ | |
--executor "docker" \ | |
--description "${name}" \ | |
--docker-image "${docker_image_version}" \ | |
--docker-volumes /cache \ | |
--docker-volumes /builds:/builds \ | |
--docker-volumes /var/run/docker.sock:/var/run/docker.sock \ | |
--docker-privileged \ | |
--docker-user "${docker_user}" \ | |
--tag-list "${tags}" \ | |
--paused \ | |
--locked="false" \ | |
--access-level="not_protected" |
Author
orihomie
commented
Feb 3, 2023
docker run -d --name gitlab-runner --restart always -v /data/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner
docker run -d --name gitlab-runner --restart always -v /data/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner
CI_PROJECT_DIR answers the following formula:
/builds/${CI_RUNNER_SHORT_TOKEN}/${CI_CONCURRENT_PROJECT_ID}/${CI_PROJECT_PATH}
https://docs.gitlab.com/runner/configuration/advanced-configuration.html#default-build-directory
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment