Skip to content

Setup GitLab SaaS Runner

Chris Caspanello edited this page May 21, 2020 · 2 revisions
  1. Start up a GitLab runner in docker by creating a docker-compose.yml file with the following:
    version: "3.7"
    
    services:
      gitlab-runner:
        image: gitlab/gitlab-runner:latest
        container_name: gitlab-runner
        volumes:
        - "./gitlab-runner/config:/etc/gitlab-runner"
        - "/var/run/docker.sock:/var/run/docker.sock"
  2. Start up the container by typing docker-compose up. It is ok if you see error logs in the runner console; we will configure the token in the next step.
  3. In GitLab; navigate to Project -> Settings -> CI/CD -> Runners. Copy the runner token.
  4. Run this script replacing <<RUNNER TOKEN>> with the value you just copied
     #!/bin/bash
     docker exec -it gitlab-runner \
     gitlab-runner register \
         --non-interactive \
         --registration-token <<RUNNER TOKEN>> \
         --locked=false \
         --description docker-stable \
         --url https://gitlab.com \
         --executor docker \
         --docker-image openjdk:8 \
         --docker-volumes "/var/run/docker.sock:/var/run/docker.sock"
    
  5. Refresh the GitLab Runner page; the runner should now be registered with a green status indicator.
Clone this wiki locally