Last active
January 29, 2025 18:12
-
-
Save radstevee/cfb5ce4a1b546ebfabb344c30c172fdc to your computer and use it in GitHub Desktop.
Gitlab runner creation via docker
This file contains hidden or 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
#!/bin/bash | |
REGISTRATION_TOKEN="..." # Deprecated but eh | |
GITLAB_URL="https://gitlab.com" | |
container=$(docker run -d --restart always \ | |
-v /srv/gitlab/runners/etc:/etc/gitlab-runner \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
gitlab/gitlab-runner:latest) | |
echo "Created container $container" | |
docker exec "$container" gitlab-runner register \ | |
--non-interactive \ | |
--url "$GITLAB_URL" \ | |
--registration-token "$REGISTRATION_TOKEN" \ | |
--executor "docker" \ | |
--docker-image "alpine:latest" \ | |
--description "docker-runner" \ | |
--tag-list "self-hosted" | |
echo "Registered runner!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment