Skip to content

Instantly share code, notes, and snippets.

@sdesalas
Last active January 24, 2022 17:36
Show Gist options
  • Save sdesalas/58fbfea60136e9493069f3a873936313 to your computer and use it in GitHub Desktop.
Save sdesalas/58fbfea60136e9493069f3a873936313 to your computer and use it in GitHub Desktop.
Gitlab Runner in Ubuntu 18/20 with TLS enabled (for docker:dind)
# 0. SET YOUR GROUP REGISTRATION TOKEN
# @see https://gitlab.com/groups/mygroup/-/settings/ci_cd#runners-settings
export GITLAB_REGISTRATION_TOKEN=abc123def456
# 1. INSTALL GITLAB RUNNER
# @see https://docs.gitlab.com/runner/install/linux-repository.html
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
export GITLAB_RUNNER_DISABLE_SKEL=true; sudo -E apt-get install gitlab-runner
# 2. INSTALL DOCKER
# @see https://docs.docker.com/engine/install/ubuntu/
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# 3. REGISTER RUNNER WITH GITLAB.COM
# @see https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
sudo gitlab-runner register -n \
--url https://gitlab.com/ \
--registration-token $GITLAB_REGISTRATION_TOKEN \
--executor docker \
--description "gitlab-runner-$(hostname)-$(date +%N)" \
--docker-image "docker:19.03.12" \
--docker-privileged \
--docker-volumes "/certs/client"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment