Configure GitLab to run Docker build in a CI Pipeline

Assuming you already have an installed an running Gitlab server, you need to install and configure a GitLab runner:

Install gitlab-runner: https://docs.gitlab.com/runner/install/linux-repository.html

Run the gitlab-runner shell setup, described here: https://docs.gitlab.com/ce/ci/docker/using_docker_build.html

Get the registration token from the Settings / CI/CD Settings page.

You can now use docker commands in the script section of your .gitlab-ci.yml file defining your pipeline.

gitlab service control commands

After installing gitlab from the omnibus install, use the gitlab-ctl command to query status, and start/stop the gitlab service (see here):

$ sudo gitlab-ctl status

If gitlab’s main service has been disabled, all the sub-services will report ‘runsv not running’:

fail: gitaly: runsv not running

You can reset the main service to run at startup with (see here):

sudo systemctl enable gitlab-runsvdir.service

To disable startup at boot:

sudo systemctl disable gitlab-runsvdir.service

If runsvdir is not enabled to start at boot, then start with:

sudo systemctl start gitlab-runsvdir.service

To start/stop gitlab:

$ sudo gitlab-ctl start

$ sudo gitlab-ctl stop