Skip to content

Instantly share code, notes, and snippets.

@editicalu
Last active March 18, 2019 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save editicalu/e4c13640da9f97c865654aca2261b5be to your computer and use it in GitHub Desktop.
Save editicalu/e4c13640da9f97c865654aca2261b5be to your computer and use it in GitHub Desktop.
Quickly setup a GitLab runner using Docker on Ubuntu
#!/bin/sh
# Should be run as root on a clean Ubuntu LTS installation
GITLAB_URL=https://gitlab.com
GITLAB_CI_TOKEN=insert-token-here
GITLAB_IMAGE=alpine
GITLAB_TAGS=ubuntu,docker
# If your hostname isn't unique, use this
#GITLAB_NAME=$RANDOM
GITLAB_NAME=`hostname`
# Install Docker
curl https://get.docker.com | sh
# Install GitLab Runner
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | bash
sudo apt-get -yqq install gitlab-runner
# Setup GitLab Runner
sudo gitlab-runner register \
--non-interactive \
--url $GITLAB_URL \
--registration-token $GITLAB_CI_TOKEN \
--executor "docker" \
--docker-image $GITLAB_IMAGE \
--description $GITLAB_NAME \
--tag-list $GITLAB_TAGS \
--run-untagged \
--locked="false" \
--docker-privileged
# Start it!
sudo gitlab-runner start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment