/docker-gitlab-runner

GitLab CI runner with docker-compose support (based on gitlab-ci-multi-runner)

Primary LanguageDockerfile

docker-gitlab-runner

This is a GitLab CI runner with docker-compose and git-lfs support.

Resources

⚠️ Important information

It is strongly recommended to run this runner on a separate Docker host VM. For some more details why and why this is not using Docker-in-Docker, please read this blog posting.

We recommend running this runner only in non-public environments, see #4 for details.

Requirements

  • host-mounted Docker socket

>= 4.1.0

  • docker >= 1.10.0

4.0.x

  • docker >= 1.9.0

1.0.0 - 3.0.0

  • docker >= 1.9.0

See also CHANGELOG for versions of docker and docker-compose on this image.

Setup

Connect to your runner host

docker-machine ssh ${RUNNER_HOST}

Get token from CI runners page (/admin/runners).

Set variables

export CI_RUNNER_TOKEN=<ENTER-YOUR-TOKEN-HERE>

Start runner (only one)

docker run -d \
    --name runner \
    --restart always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /home/gitlab-runner/config:/etc/gitlab-runner \
    -v /home/gitlab-runner/builds:/home/gitlab-runner/builds \
    schmunk42/gitlab-runner:4.2.0-rc1

⚠️ It is very important to mount /home/gitlab-runner to the same path inside the runner container.

First time setup

edit /home/gitlab-runner/config

Change concurrent setting.

Usage

Obtain token from GitLab CI runners page, and export it.

Debug commands

docker exec -it runner gitlab-runner verify

Start runner instances (TODO: check, if they run in parallel)

docker exec -it runner gitlab-runner \
    register \
        --executor shell \
        -u https://my.gitlab.server:443/ci \
        -r ${RUNNER_TOKEN} \
        -n

Building the image

docker build --pull -t local/runner .

Check version of runner

docker run local/runner -v 

Built by dmstr