Skip to content

Instantly share code, notes, and snippets.

@neilkuan
Last active November 24, 2020 02:34
Show Gist options
  • Save neilkuan/d30c2a66162f9b0b1c666c15d51813c7 to your computer and use it in GitHub Desktop.
Save neilkuan/d30c2a66162f9b0b1c666c15d51813c7 to your computer and use it in GitHub Desktop.
Example Register Docker Runner Shell Script .
#!/bin/bash
RUNNER_TOKEN=$1
# Register
docker run -it --rm -v /root/gitlab-runner-sit:/etc/gitlab-runner gitlab/gitlab-runner:alpine \
register --non-interactive --url https://gitlab.com \
--registration-token ${RUNNER_TOKEN} --docker-pull-policy if-not-present \
--docker-volumes /var/run/docker.sock:/var/run/docker.sock --executor docker \
--docker-volumes /root/.m2:/root/.m2 \
--docker-image alpine:latest --description "Docker Runner" --docker-privileged \
--tag-list "sit,build,sc" --tls-ca-file=/etc/gitlab-runner/certs/gitlab.com.crt
# Run
docker run -d --name sit-build-runner -v /root/gitlab-runner-sit:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:alpine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment