phihos / docker-gitlab-runner

A dockerized GitLab runner that automatically registers before running.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker GitLab Runner

Automated Build Docker Build Status

A dockerized GitLab runner that automatically registers before running. The first time the container runs it is registered with GitLab. If the configuration file already exists this step is skipped.

How to run

For a shell runner run

docker run --detach \
    --name gitlab-runner \
    --restart=always \
    -e REGISTRATION_TOKEN=XXXXXXXXXX \
    -e CI_SERVER_URL=http://gitlab.mydomain.com \
    -e RUNNER_EXECUTOR=shell \
    -e RUNNER_SHELL=bash \
    --volume /etc/gitlab-runner:/etc/gitlab-runner \
    phihos/gitlab-runner

For a Docker runner run

docker run --detach \
      --name gitlab-runner \
      --restart always \
      -e REGISTRATION_TOKEN=XXXXXXXXXX \
      -e CI_SERVER_URL=http://gitlab.mydomain.com \
      -e RUNNER_EXECUTOR=docker \
      -e DOCKER_IMAGE="ubuntu:latest" \
      --volume /etc/gitlab-runner:/etc/gitlab-runner \
      --volume /var/run/docker.sock:/var/run/docker.sock \
      phihos/gitlab-runner

For a list of possible environment variables run

docker run gitlab/gitlab-runner register --help

Each command line options has a corresponding environment variable that can be set. Currently the RUNNER_ENV variable does not allow multiple values (see below).

RUNNER_ENV workaround

Currently it is not possible to specify multiple environment variables via RUNNER_ENV. As a workaround you can specify RUNNER_ENV_1, RUNNER_ENV_2, ..., RUNNER_ENV_256. This fix was taken from here.

License

Please see LICENSE

About

A dockerized GitLab runner that automatically registers before running.

License:MIT License


Languages

Language:Shell 91.2%Language:Dockerfile 8.8%