Gitlab Runner Docker Install

/ Comments off

I’ve got a project which takes a long time to build. I’ve been using the shared runners on GitLab. However, the total time constraint has become a serious limitation (ideally I want to rebuild my project fairly regularly).

I’m going to install GitLab Runner as a Docker service on an underutilised EC2 instance.

Background information on Continuous Integration with GitLab can be found here.

GitLab CI Multi Runner used to fetch and run pipeline jobs with GitLab CI. Pulls 500M+ Overview Tags. GitLab Runner Docker images. We don't monitor the comments here, i. GitLab Runner officially supported binaries are available for the following architectures: x86, AMD64, ARM64, ARM, s390x, ppc64le Official packages are available for the following Linux distributions.

Start Runner Container

First create an instance of the GitLab Runner container.

More information about the GitLab Runner can be found here.

Obtain a Token

Either for a single project or a group:

  • go to Settings > CI/CD
  • expand the Runners section
  • copy the token from the Set up a specific Runner manually section.

Register a Runner

To register a runner, use the register command.

💡 This seems repetitive, but there’s a reason for the repetition: the first gitlab-runner refers to the running container, while the second reference specifies a command to run within the container.

📌 If you need to use Docker-in-Docker (for example, to build a Docker image as part of the CI/CD process) then you should also specify the --docker-privileged flag.

Provide the following input:

  • Specify as the coordinator URL.
  • Provide the token.
  • Provide a description for the runner.
  • Supply tags for the runner (can leave this blank for the moment).
  • Specify docker as the executor.
  • Specify a default Docker image (for example, rocker/verse:latest) which will be used if an image is not given in .gitlab-ci.yml.

The runner should be automatically restarted. However, you can restart manually just to be sure:

If you refresh the Settings > CI/CD page you should see the newly created runner listed.

🚨 If you do add a runner using the --docker-privileged then you’ll probably want to be selective about what repositories have access to that runner. So, for example, it would probably be advisable to assign specific repositories to the runner rather than entire groups. Also, importantly, you’ll want to disable any shared or group runners for those repositories so that they end up actually using this privileged runner.

Listing Runners

To list the configured runners, use the list command.

Typical output might look something like this:

Stopping, Starting and Restarting the Runners

You can stop the runners using the stop command.

And start them using the start command.

You can perform both actions in sequence with the restart command.

Deregister a Runner

Deregister by name.

Configuration File

Gitlab Runner Install Docker Image

The config.toml configuration file will be accessible at /srv/gitlab-runner/config/config.toml on the host machine.

Some global options that you might want to tweak:

  • log_level
  • log_format
  • concurrent — the number of jobs which can be run concurrently (default: 1); and
  • check_interval — how long to wait (in seconds) between checks for new jobs.

Each of the configured runners will have a section in this file which looks something like this:

More information on these configuration parameters can be found here.

With your own runner you’re no longer constrained by the limitations of the (totally awesome!) GitLab shared runners. You can run jobs with impunity, not giving a moment’s thought to running into those resource limits.

Use CI/CD and prosper!

Sudo apt-get install docker-ce=5:19.03.103-0ubuntu-focal docker-ce-cli=5:19.03.103-0ubuntu-focal If you just want to latest version without specifying above, run the commands below. The command below will always install the highest possible version. Install GitLab Runner using the official GitLab repositories. Ubuntu, Mint, RHEL, Fedora, and CentOS. Make sure to install Docker before using GitLab Runner. Docker images; SELinux. Run GitLab Runner in a container. This is how you can run GitLab Runner inside a Docker container. General GitLab Runner Docker image usage. GitLab Runner Docker images (based on Ubuntu or Alpine Linux) are designed as wrappers around the standard gitlab-runner command, like if GitLab Runner was installed directly on the.

  • Install the Docker image and start the container

This is how you can run GitLab Runner inside a Docker container.

I had this problem recently where apt install wget does not find anything. As it turns out apt update was never run. Apt update apt install wget After discussing this with a coworker we mused that apt update is likely not run in order to save both time and space in the docker image. Fedora 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.

General GitLab Runner Docker image usage

GitLab Runner Docker images (based on Ubuntu or Alpine Linux)are designed as wrappers around the standard gitlab-runner command, like ifGitLab Runner was installed directly on the host.

The general rule is that every GitLab Runner command that normally would be executedas:

can be executed with:

For example, getting the top-level help information for GitLab Runner command could beexecuted as:

In short, the gitlab-runner part of the command is replaced withdocker run [docker options] gitlab/gitlab-runner, while the rest of thecommand stays as it is described in the register documentation.The only difference is that the gitlab-runner command is executed inside of aDocker container.

Install the Docker image and start the container

Before you begin, ensure Docker is installed.

To run gitlab-runner inside a Docker container, you need to make sure that the configuration is not lost when the container is restarted. To do this, there are two options, which are described below.

Make sure that you read the FAQ section which describes some of the most common problems with GitLab Runner.

If you are using a session_server, you will also need to expose port 8093 by adding -p 8093:8093 to your docker run command.

Option 1: Use local system volume mounts to start the Runner container

This example uses the local system for the configuration volume that is mounted into the gitlab-runner container. This volume is used for configs and other resources.

Option 2: Use Docker volumes to start the Runner container

Gitlab Runner Docker Install

In this example, you can use a configuration container to mount your custom data volume.

  1. Create the Docker volume:

  2. Start the GitLab Runner container using the volume we just created:

To set the container’s timezone, in the docker run command, use the flag --env TZ=<TIMEZONE>. View a list of available time zones.

Register the runner

The final step is to register a new runner. The GitLab Runner Container won’t pick up any jobs until it’s registered.

Update configuration

If you change the configuration in config.toml, you might need to restart the runner to apply the change.Make sure to restart the whole container instead of using gitlab-runner restart:

Upgrade version

Pull the latest version (or a specific tag):

Stop and remove the existing container:

Start the container as you did originally:

You need to use the same method for mounting you data volume as youdid originally (-v /srv/gitlab-runner/config:/etc/gitlab-runner or--volumes-from gitlab-runner-config).

Reading GitLab Runner logs

When GitLab Runner is started as a foreground task (whether it’s a locally installed binary orinside of a Docker Container), the logs are printed to the standard output. WhenGitLab Runner is started as a system service (e.g. with Systemd), the logs are in mostcases logged through Syslog or other system logging mechanism.

With GitLab Runner started as a Docker based service, since the gitlab-runner ... command isthe main process of the container, the logs can be read using the docker logs command.

For example, if GitLab Runner was started with the following command:

you may get the logs with:

where gitlab-runner is the name of the container, set with --name gitlab-runner bythe first command.

You may find more information about handling container logs at the Docker documentationpage.

Installing trusted SSL server certificates

If your GitLab CI server is using self-signed SSL certificates then you shouldmake sure the GitLab CI server certificate is trusted by the GitLab Runnercontainer for them to be able to talk to each other.

The gitlab/gitlab-runner image is configured to look for the trusted SSLcertificates at /etc/gitlab-runner/certs/ca.crt, this can however be changed using the-e 'CA_CERTIFICATES_PATH=/DIR/CERT' configuration option.

Copy the ca.crt file into the certs directory on the data volume (or container).The ca.crt file should contain the root certificates of all the servers youwant GitLab Runner to trust. The GitLab Runner container willimport the ca.crt file on startup so if your container is already running youmay need to restart it for the changes to take effect.

Docker images

The following multi-platform Docker images are available:

  • gitlab/gitlab-runner:latest based on Ubuntu.
  • gitlab/gitlab-runner:alpine based on Alpine with much a smaller footprint(~160/350 MB Ubuntu vs ~45/130 MB Alpine compressed/decompressed).

See GitLab Runnersource for possible build instructions for both Ubuntu and Alpine images.

The IBM Z image does not contain the docker-machine dependency, as it is not yet maintained for the Linux s390xplatform. See issue for current status.


Some distributions (CentOS, RedHat, Fedora) use SELinux by default to enhance the security of the underlying system.

Special care must be taken when dealing with such a configuration.

  1. If you want to use the Docker executor to run builds in containers, you’ll need access to /var/run/docker.sock.However, if SELinux is in enforcing mode, you will see a Permission denied error when you’re accessing /var/run/docker.sock.Install selinux-dockersock to resolve this issue.
  2. Make sure that a persistent directory is created on host: mkdir -p /srv/gitlab-runner/config.
  3. Run Docker with :Z on volumes:

More information about the cause and resolution can be found here:

Help & feedback

Edit this pageto fix an error or add an improvement in a merge request.
Create an issueto suggest an improvement to this page.
Show and post commentsto review and give feedback about this page.
Create an issueif there's something you don't like about this feature.
Propose functionalityby submitting a feature request.
Join First Lookto help shape new features.
Feature availability and product trials
View pricingto see all GitLab tiers and features, or to upgrade.
Try GitLab for freewith access to all features for 30 days.
Get Help

If you didn't find what you were looking for,search the docs.

If you want help with something specific and could use community support,post on the GitLab forum.

Install Gitlab Docker Ubuntu

For problems setting up or using this feature (depending on your GitLabsubscription).

Install Gitlab Docker Ubuntu Free

Request supportPlease enable JavaScript to view thecomments powered by Disqus.

Estimated reading time: 7 minutes

You can run Compose on macOS, Windows, and 64-bit Linux.


Docker Compose relies on Docker Engine for any meaningful work, so make sure youhave Docker Engine installed either locally or remote, depending on your setup.

  • On desktop systems like Docker Desktop for Mac and Windows, Docker Compose isincluded as part of those desktop installs.

  • On Linux systems, first install theDocker Enginefor your OS as described on the Get Docker page, then come back here forinstructions on installing Compose onLinux systems.

  • To run Compose as a non-root user, see Manage Docker as a non-root user.

Install Compose

Follow the instructions below to install Compose on Mac, Windows, Windows Server2016, or Linux systems, or find out about alternatives like using the pipPython package manager or installing Compose as a container.

Install a different version

The instructions below outline installation of the current stable release(v1.28.6) of Compose. To install a different version ofCompose, replace the given release number with the one that you want. Composereleases are also listed and available for direct download on theCompose repository release page on GitHub.To install a pre-release of Compose, refer to the install pre-release buildssection.

Install Compose on macOS

Docker Desktop for Mac includes Compose alongwith other Docker apps, so Mac users do not need to install Compose separately.For installation instructions, see Install Docker Desktop on Mac.

Install Compose on Windows desktop systems

Docker Desktop for Windows includes Composealong with other Docker apps, so most Windows users do not need toinstall Compose separately. For install instructions, see Install Docker Desktop on Windows.

If you are running the Docker daemon and client directly on MicrosoftWindows Server, follow the instructions in the Windows Server tab.

Install Compose on Windows Server

Follow these instructions if you are running the Docker daemon and client directlyon Microsoft Windows Server and want to install Docker Compose.

  1. Start an “elevated” PowerShell (run it as administrator).Search for PowerShell, right-click, and chooseRun as administrator. When asked if you want to allow this appto make changes to your device, click Yes.

  2. In PowerShell, since GitHub now requires TLS1.2, run the following:

    Then run the following command to download the current stable release ofCompose (v1.28.6):

Note: On Windows Server 2019, you can add the Compose executable to $Env:ProgramFilesDocker. Because this directory is registered in the system PATH, you can run the docker-compose --version command on the subsequent step with no additional configuration.

  1. Test the installation.

Install Compose on Linux systems

On Linux, you can download the Docker Compose binary from theCompose repository release page on GitHub.Follow the instructions from the link, which involve running the curl commandin your terminal to download the binaries. These step-by-step instructions arealso included below.

For alpine, the following dependency packages are needed:py-pip, python3-dev, libffi-dev, openssl-dev, gcc, libc-dev, rust, cargo and make.

Docker Install Ubuntu

  1. Run this command to download the current stable release of Docker Compose:

    To install a different version of Compose, substitute 1.28.6with the version of Compose you want to use.

    If you have problems installing with curl, seeAlternative Install Options tab above.

  2. Apply executable permissions to the binary:

Note: If the command docker-compose fails after installation, check your path.You can also create a symbolic link to /usr/bin or any other directory in your path.

For example:

  1. Optionally, install command completion for thebash and zsh shell.

  2. Test the installation.

Alternative install options

Install using pip

For alpine, the following dependency packages are needed:py-pip, python3-dev, libffi-dev, openssl-dev, gcc, libc-dev, rust, cargo, and make.

Compose can be installed frompypi using pip. If you installusing pip, we recommend that you use avirtualenv because many operatingsystems have python system packages that conflict with docker-composedependencies. See the virtualenvtutorial to getstarted.

If you are not using virtualenv,

pip version 6.0 or greater is required.

Docker Install Windows

Install as a container

Compose can also be run inside a container, from a small bash script wrapper. Toinstall compose as a container run this command:

Install pre-release builds

If you’re interested in trying out a pre-release build, you can download releasecandidates from the Compose repository release page on GitHub.Follow the instructions from the link, which involves running the curl commandin your terminal to download the binaries.

Pre-releases built from the “master” branch are also available for download at

Pre-release builds allow you to try out new features before they are released,but may be less stable.

Gitlab Runner Docker Install For Chrome


If you’re upgrading from Compose 1.2 or earlier, remove ormigrate your existing containers after upgrading Compose. This is because, as ofversion 1.3, Compose uses Docker labels to keep track of containers, and yourcontainers need to be recreated to add the labels.

If Compose detects containers that were created without labels, it refusesto run, so that you don’t end up with two sets of them. If you want to keep usingyour existing containers (for example, because they have data volumes you wantto preserve), you can use Compose 1.5.x to migrate them with the followingcommand:

Alternatively, if you’re not worried about keeping them, you can remove them.Compose just creates new ones.


Gitlab Ci Docker Install Packages

To uninstall Docker Compose if you installed using curl:

To uninstall Docker Compose if you installed using pip:

Got a “Permission denied” error?

If you get a “Permission denied” error using either of the abovemethods, you probably do not have the proper permissions to removedocker-compose. To force the removal, prepend sudo to either of the abovecommands and run again.

Where to go next

compose, orchestration, install, installation, docker, documentation