Skip to content

pozgo/docker-gitlab-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitLab Runner in docker (CentOS 7)

Build Status GitHub Open Issues FOSSA Status

Stars Fork

Docker build

Felling like supporting me in my projects use donate button. Thank You!

Docker Image with GitLab Runner. It can be used as base image for more complex runners.

More versions available through tags

Environmental Variable

Variable Description
RUNNER_NAME Name that should be reported in Gitlab
RUNNER_URL Gitlab url
RUNNER_REGISTRATION_TOKEN Registration token
RUNNER_EXECUTOR Default set to shell
RUNNER_EXTRA_PARAMS Any other options available via cli

Usage

docker run \
    -d \
    --name gitlab-runner \
    -e "RUNNER_URL=http://my-gitlab.com" \
    -e "RUNNER_REGISTRATION_TOKEN=token" \
    -e "RUNNER_EXTRA_PARAMS=--tag-list=\"build, test, deploy\"" \
    polinux/gitlab-runner

Use docker-compose.yml file which contain basic setup of gitlab server with stand alone approach.

docker-compose up

Use automated script with docker-compose.yml

Start runner

./runner start
Starting Runner ...
Creating runner ... done
Runner started.
Following Log of runner...
Attaching to runner
runner    | [2018-11-22 20:50:42] Registering runner.
runner    | [2018-11-22 20:50:42] gitlab-runner register --non-interactive --name="runner" --url="https://my-gitlab.com/" --registration-token="xxxxxxxxxxxxxxxxx" --executor="shell"
runner    | Runtime platform                                    arch=amd64 os=linux pid=15 revision=cf91d5e1 version=11.4.2
runner    | Running in system-mode.
runner    |
runner    | Registering runner... succeeded                     runner=uM6p5qyF
runner    | Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
runner    | GLTOKEN: 7e02f2402198e879bcb9718ec47ce7
runner    | 2018-11-22 20:50:42,645 CRIT Supervisor running as root (no user in config file)
runner    | 2018-11-22 20:50:42,645 INFO Included extra file "/etc/supervisor.d/gitlab-runner.conf" during parsing
runner    | Unlinking stale socket /run/supervisor.sock
runner    | 2018-11-22 20:50:42,960 INFO RPC interface 'supervisor' initialized
runner    | 2018-11-22 20:50:42,960 CRIT Server 'unix_http_server' running without any HTTP authentication checking
runner    | 2018-11-22 20:50:42,961 INFO supervisord started with pid 32
runner    | 2018-11-22 20:50:43,964 INFO spawned: 'gitlab-runner' with pid 35
runner    | 2018-11-22 20:50:43,991 DEBG 'gitlab-runner' stderr output:
runner    | Runtime platform                                    arch=amd64 os=linux pid=35 revision=cf91d5e1 version=11.4.2
runner    |
runner    | 2018-11-22 20:50:43,991 DEBG 'gitlab-runner' stderr output:
runner    | Starting multi-runner from /etc/gitlab-runner/config.toml ...  builds=0
runner    | Running in system-mode.
runner    |
runner    | Configuration loaded                                builds=0
runner    |
runner    | 2018-11-22 20:50:43,992 DEBG 'gitlab-runner' stderr output:
runner    | Listen address not defined, metrics server disabled  builds=0
runner    | Listen address not defined, session server disabled  builds=0
runner    |
runner    | 2018-11-22 20:50:44,994 INFO success: gitlab-runner entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Unregister and remove runner

./runner delete
Unregistering runner with Token:  7e02f2402198e879bcb9718ec47ce7
Runtime platform                                    arch=amd64 os=linux pid=46 revision=cf91d5e1 version=11.4.2
Running in system-mode.

Unregistering runner from GitLab succeeded          runner=7e02f240
Updated /etc/gitlab-runner/config.toml
Runner Unregistered
Stopping Runner
Stopping runner ... done
Removing runner
Going to remove runner
Removing runner ... done

Build

docker build -t polinux/gitlab-runner .

Docker troubleshooting

Use docker command to see if all required containers are up and running:

$ docker ps

Check logs of gitlab server container:

$ docker logs gitlab-runner

Sometimes you might just want to review how things are deployed inside a running container, you can do this by executing a bash shell through _docker's exec_ command:

docker exec -ti gitlab-runner /bin/bash

History of an image and size of layers:

docker history --no-trunc=true polinux/gitlab-runner | tr -s ' ' | tail -n+2 | awk -F " ago " '{print $2}'

Author

Przemyslaw Ozgo (linux@ozgo.info)


Acknowledgements

I would like to thank JetBrains for supporting me with Open Source endeavours.

License

FOSSA Status