{"id":16540589,"url":"https://github.com/sameersbn/docker-gitlab-ci-runner","last_synced_at":"2025-03-16T19:32:06.400Z","repository":{"id":14993857,"uuid":"17719179","full_name":"sameersbn/docker-gitlab-ci-runner","owner":"sameersbn","description":"Dockerfile to build a base GitLab CI Runner container image.","archived":false,"fork":false,"pushed_at":"2016-03-12T07:29:32.000Z","size":523,"stargazers_count":97,"open_issues_count":4,"forks_count":36,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-15T21:47:44.730Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sameersbn.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-13T17:17:13.000Z","updated_at":"2024-11-21T22:02:45.000Z","dependencies_parsed_at":"2022-09-11T00:51:10.577Z","dependency_job_id":null,"html_url":"https://github.com/sameersbn/docker-gitlab-ci-runner","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sameersbn%2Fdocker-gitlab-ci-runner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sameersbn%2Fdocker-gitlab-ci-runner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sameersbn%2Fdocker-gitlab-ci-runner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sameersbn%2Fdocker-gitlab-ci-runner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sameersbn","download_url":"https://codeload.github.com/sameersbn/docker-gitlab-ci-runner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826792,"owners_count":20354220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T18:52:50.940Z","updated_at":"2025-03-16T19:32:06.144Z","avatar_url":"https://github.com/sameersbn.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n**NOTICE**: `gitlab-ci-runner` has been deprecated by GitLab in favour of the highly performant and feature rich [gitlab-ci-multi-runner](https://gitlab.com/gitlab-org/gitlab-ci-multi-runner). `gitlab-ci-multi-runner` is implemented in golang and has the ability to launch CI tests in docker containers.\n\n# Table of Contents\n- [Introduction](#introduction)\n\t- [Version](#version)\n\t- [Changelog](Changelog.md)\n- [Contributing](#contributing)\n- [Reporting Issues](#reporting-issues)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Configuration](#configuration)\n\t- [Data Store](#data-store)\n\t- [Installing Trusted SSL Server Certificates](#installing-trusted-ssl-server-certificates)\n- [Deploy Keys](#deploy-keys)\n- [Configuration Parameters](#configuration-parameters)\n- [Shell Access](#shell-access)\n- [Upgrading](#upgrading)\n- [References](#references)\n\n# Introduction\n\nDockerfile to build a GitLab CI Runner base image. You can use this as the base image to build your own runner images. The [sameersbn/runner-gitlab](https://github.com/sameersbn/docker-runner-gitlab) project demonstrates its use to build a CI image for GitLab CE.\n\n## Version\n\nCurrent Version: **5.2.1**\n\n# Contributing\n\nIf you find this image useful here's how you can help:\n\n- Send a Pull Request with your awesome new features and bug fixes\n- Help new users with [Issues](https://github.com/sameersbn/docker-gitlab-ci-runner/issues) they may encounter\n- Support the development of this image with a [donation](http://www.damagehead.com/donate/)\n\n# Reporting Issues\n\nDocker is a relatively new project and is active being developed and tested by a thriving community of developers and testers and every release of docker features many enhancements and bugfixes.\n\nGiven the nature of the development and release cycle it is very important that you have the latest version of docker installed because any issue that you encounter might have already been fixed with a newer docker release.\n\nFor ubuntu users I suggest [installing docker](https://docs.docker.com/installation/ubuntulinux/) using docker's own package repository since the version of docker packaged in the ubuntu repositories are a little dated.\n\nHere is the shortform of the installation of an updated version of docker on ubuntu.\n\n```bash\nsudo apt-get purge docker.io\ncurl -s https://get.docker.com/ | sudo sh\nsudo apt-get update\nsudo apt-get install lxc-docker\n```\n\nFedora and RHEL/CentOS users should try disabling selinux with `setenforce 0` and check if resolves the issue. If it does than there is not much that I can help you with. You can either stick with selinux disabled (not recommended by redhat) or switch to using ubuntu.\n\nIf using the latest docker version and/or disabling selinux does not fix the issue then please file a issue request on the [issues](https://github.com/sameersbn/docker-gitlab-ci-runner/issues) page.\n\nIn your issue report please make sure you provide the following information:\n\n- The host ditribution and release version.\n- Output of the `docker version` command\n- Output of the `docker info` command\n- The `docker run` command you used to run the image (mask out the sensitive bits).\n\n# Installation\n\nPull the latest version of the image from the docker index. This is the recommended method of installation as it is easier to update image in the future. These builds are performed by the **Docker Trusted Build** service.\n\n```bash\ndocker pull sameersbn/gitlab-ci-runner:latest\n```\n\nStarting from GitLab CI Runner version `5.2.1`, You can pull a particular version of GitLab CI Runner by specifying the version number. For example,\n\n```bash\ndocker pull sameersbn/gitlab-ci-runner:5.2.1\n```\n\nAlternately you can build the image yourself.\n\n```bash\ngit clone https://github.com/sameersbn/docker-gitlab-ci-runner.git\ncd docker-gitlab-ci-runner\ndocker build --tag=\"$USER/gitlab-ci-runner\" .\n```\n\n# Quick Start\n\nFor a runner to do its trick, it has to first be registered/authorized on the GitLab CI server. This can be done by running the image with the `app:setup` command.\n\n```bash\nmkdir -p /opt/gitlab-ci-runner\ndocker run --name gitlab-ci-runner -it --rm \\\n\t-v /opt/gitlab-ci-runner:/home/gitlab_ci_runner/data \\\n  sameersbn/gitlab-ci-runner:5.2.1 app:setup\n```\n\nThe command will prompt you to specify the location of the GitLab CI server and provide the registration token to access the server. With this out of the way the image is ready, lets get is started.\n\n```bash\ndocker run --name gitlab-ci-runner -it --rm \\\n\t-v /opt/gitlab-ci-runner:/home/gitlab_ci_runner/data \\\n\tsameersbn/gitlab-ci-runner:5.2.1\n```\n\nYou now have a basic runner up and running. But in this form its more or less useless. See [sameersbn/runner-gitlab](https://github.com/sameersbn/docker-runner-gitlab) to understand how you can use this base image to build a runner for your own projects.\n\n# Configuration\n\n## Data Store\n\nGitLab CI Runner saves the configuration for connection and access to the GitLab CI server. In addition, SSH keys are generated as well. To make sure this configuration is not lost when when the container is stopped/deleted, we should mount a data store volume at\n\n* `/home/gitlab_ci_runner/data`\n\nVolumes can be mounted in docker by specifying the **'-v'** option in the docker run command.\n\n```bash\nmkdir /opt/gitlab-ci-runner\ndocker run --name gitlab-ci-runner -it --rm -h gitlab-ci-runner.local.host \\\n  -v /opt/gitlab-ci-runner:/home/gitlab_ci_runner/data \\\n  sameersbn/gitlab-ci-runner:5.2.1\n```\n\n## Installing Trusted SSL Server Certificates\n\nIf your GitLab server is using self-signed SSL certificates then you should make sure the GitLab server certificate is trusted on the runner for the git clone operations to work.\n\nThe default path the runner is configured to look for the trusted SSL certificates is at `/home/gitlab_ci_runner/data/certs/ca.crt`, this can however be changed using the `CA_CERTIFICATES_PATH` configuration option.\n\nIf you remember from above, the `/home/gitlab_ci_runner/data` is the path of the [data store](#data-store), which means that we have to create a folder named `certs` inside `/opt/gitlab-ci-runner/data/` and copy the `ca.crt` file into it.\n\nThe `ca.crt` file should contain the root certificates of all the servers you want to trust. With respect to GitLab, this will be the contents of the `gitlab.crt` file as described in the [README](https://github.com/sameersbn/docker-gitlab/blob/master/README.md#ssl) of the [docker-gitlab](https://github.com/sameersbn/docker-gitlab) container.\n\n# Deploy Keys\n\nThe image automatically generates a deploy keys for the `gitlab_ci_runner` user and these keys are available at the data volume at `/home/gitlab_ci_runner/data/.ssh`. You can overwrite these keys if you wish to do so.\n\nIf the runner needs to access a private git repo then add the generated public key to your projects deploy keys so that the runner can clone the required repos.\n\n*NOTE: The deploy keys are generated without a passphrase.*\n\n# Configuration Parameters\n\n*Please refer the docker run command options for the `--env-file` flag where you can specify all required environment variables in a single file. This will save you from writing a potentially long docker run command.*\n\nBelow is the list of available options that you can use to configure your runner.\n\n- **CI_SERVER_URL**: The hostname of the GitLab CI server. No defaults\n- **REGISTRATION_TOKEN**: The token to use to register on the CI server\n*The above two options are only applicable if you want to skip the `app:setup` step and want to instead provide these parameters at launch. Additionally, they are effective only the first time you launch the container*\n\n# Shell Access\n\nFor debugging and maintenance purposes you may want access the containers shell. If you are using docker version `1.3.0` or higher you can access a running containers shell using `docker exec` command.\n\n```bash\ndocker exec -it gitlab-ci-runner bash\n```\n\nIf you are using an older version of docker, you can use the [nsenter](http://man7.org/linux/man-pages/man1/nsenter.1.html) linux tool (part of the util-linux package) to access the container shell.\n\nSome linux distros (e.g. ubuntu) use older versions of the util-linux which do not include the `nsenter` tool. To get around this @jpetazzo has created a nice docker image that allows you to install the `nsenter` utility and a helper script named `docker-enter` on these distros.\n\nTo install `nsenter` execute the following command on your host,\n\n```bash\ndocker run --rm -v /usr/local/bin:/target jpetazzo/nsenter\n```\n\nNow you can access the container shell using the command\n\n```bash\nsudo docker-enter gitlab-ci-runner\n```\n\nFor more information refer https://github.com/jpetazzo/nsenter\n\n# Upgrading\n\nTo update the runner, simply stop the image and pull the latest version from the docker index.\n\n```bash\ndocker pull sameersbn/gitlab-ci-runner:5.2.1\ndocker stop gitlab-ci-runner\ndocker rm gitlab-ci-runner\ndocker run --name gitlab-ci-runner -d [OPTIONS] sameersbn/gitlab-ci-runner:5.2.1\n```\n\n# References\n  * https://gitlab.com/gitlab-org/gitlab-ci-runner/blob/master/README.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsameersbn%2Fdocker-gitlab-ci-runner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsameersbn%2Fdocker-gitlab-ci-runner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsameersbn%2Fdocker-gitlab-ci-runner/lists"}