Both containers (the temporary one and the actual gitlab-runner instance) share a volume together -v /srv/gitlab-runner/config:/etc/gitlab-runner in which the registration token is stored. The actual instance of the runner can then use that token from the generated config to authenticate with the gitlab instance.

Answer from pat on Stack Overflow
Discussions

GitLab Runner in Docker
I’d suggest setting up your runners using the docker executor - https://docs.gitlab.com/runner/executors/docker.html This allows your runner to start up fresh containers for jobs with the image you specify, meaning jobs aren’t running on the host and can have whatever you need. You can then also use a single runner with parallelism instead of multiple runners. Downside is that if you need to install extras they will need to install as part of the CI on every job. More on reddit.com
🌐 r/gitlab
6
3
August 31, 2023
Permission issue with gitlab-runner
It turned out I needed to add the gitlab-runner user to the docker group and stop running commands with sudo as you said . More on reddit.com
🌐 r/gitlab
6
2
July 17, 2023
Confused with gitlab-runner and executor
First q - nope! When people refer to the executor, they (should) only mean "the mechanism of which will be the acting environment for your pipeline commands to run in". If you use a shell-executor, it could be performed by the docker install or the binary install of the runner, and same for the docker-executor 2. Performance can be a bit of an issue - the trade off with dockerized builds are that 1 computer/VM can run multiple, simultaneous, totally isolated pipelines, whereas a shell runner can only safely run 1. While performance might drop off, there's the gain of not having to have several machines/vm's created (much more overhead from a full-os vs just a container). For context, I see network latency increase when I use a docker-windows executor running 5 different queued pipeline tasks on this 1 machine (16gb Ram, 8 CPU) and some CPU drop off, but if I were to spin up 5 different machines to handle this same work load (5 pipeline tasks queued at the same time, I'm probably not fully utilizing the resources but I definitely am hogging more resources that could be leveraged. Now taking into consideration that you have both a shell & a docker executor, it would depend on what kind of code you're pipeline is working with and how a build consumes resources - if you are building a java project, it would be hard to see a performance impact unless it's true massive, but for something like NodeJS with tons of packages, it would definitely cause impact if the shell runner executed a job while the docker executor took a few jobs as well, if say, using that same 16gb RAM & 8 Core machine. For some organization, I've kept shell runners on their own machine, because if someone edits their gitlab ci file to do something that affects the shell runner permanently (like "sudo apt upgrade", or something that causes a variable to linger beyond the build that affects the next build) then I have to worry about fixing that issue. There are good use cases for the shell runners though, but the docker executors provide the quickest way to scale pipelines to 100+ repositories, averaging 10 builds an hour during work hours (20 min pipeline execution). In some sort of motivational stance, if you have the extra machine power waiting around, I think you should be adding more features into your pipeline, which would then show you the need for the simultaneous task execution. Gitlab 's SAST jobs, coverage testing, linting, or even live execution of code for smoke tests or things of that nature could be explored to add value to the pipelines. All those combined would create a lengthy pipeline execution time, so there's more reason to attempt to run as many as these in parallel as possible. More on reddit.com
🌐 r/gitlab
1
3
May 5, 2023
x509 Error when registering runner: Is there a way to do an sslNoverify with Gitlab Runners like you can with Git?
Pretty sure the answer is no, no way to explicitly tell it to ignore SSL errors. https://docs.gitlab.com/runner/configuration/advanced-configuration.html From a security perspective its probably worth the effort to get your certs working though. https://docs.gitlab.com/runner/configuration/tls-self-signed.html Its mostly just putting your root cert / self signed cert in the `/etc/gitlab-runner/certs` directory. More on reddit.com
🌐 r/gitlab
3
1
January 3, 2022
🌐
Medium
medium.com › @BuildWithLal › dockerized-gitlab-ci-setting-up-and-connecting-your-gitlab-runner-b810a02e42f2
Dockerized GitLab CI: Setting Up and Connecting Your GitLab Runner | by Lal Zada | Medium
October 10, 2024 - After updating the docker-compose.yml file, hit CTRL+C to stop the running container and then run ... Keep watching for the health status of both Gitlab Server and Runner containers. ... Once both are healthy, you can go back to the Runner page for your project here http://localhost:8000/root/build-with-lal/-/settings/ci_cd under ... Click on the New project runner and follow the same steps as we followed earlier to generate command for registering GitLab runner which will look like this
🌐
Medium
medium.com › @BuildWithLal › dockerized-gitlab-ci-register-docker-executor-as-a-gitlab-runner-71799352c9ac
Dockerized GitLab CI: Register Docker Executor as a GitLab Runner | by Lal Zada | Medium
October 10, 2024 - Once you have updated docker-compose.yml, hit CTRL+C to stop running containers and then run ... Existing runner is the Shell executor we created in our last post. ... Fill out the runner details. Make sure to add tags so we can run different jobs by specifying a specific runner using these tags. ... Once logged in to the GitLab runner container, run command from the above Step 1. Make sure to add these flags to the end of the gitlab-runner register …
🌐
GitLab
docs.gitlab.com › gitlab docs › install › install gitlab runner › docker
Run GitLab Runner in a container | GitLab Docs
For system volume mounts, add -v /srv/gitlab-runner/docker-machine-config:/root/.docker/machine · For Docker named volumes, add -v docker-machine-config:/root/.docker/machine · Register a new runner.
🌐
OneUptime
oneuptime.com › home › blog › how to set up docker with gitlab ci runner
How to Set Up Docker with GitLab CI Runner
January 16, 2026 - # Register with all options gitlab-runner register \ --non-interactive \ --url "https://gitlab.com/" \ --token "RUNNER_AUTHENTICATION_TOKEN" \ --executor "docker" \ --docker-image "alpine:latest" \ --description "docker-runner"
🌐
GitLab
gitlab.com › gitlab.org › gitlab-runner › repository
docs/register · 19a93fdee8c7dc6b24baa87d19ac7009aa5c0940 · GitLab.org / gitlab-runner · GitLab
If you're running the runner in a Docker container, the register command is structured similar to the following: docker run --rm -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register \ --non-interactive \ --executor "docker" ...
Find elsewhere
🌐
Docker Hub
hub.docker.com › r › flakm › gitlab-runner-auto-register
flakm/gitlab-runner-auto-register - Docker Image
docker run --rm --entrypoint "/usr/bin/gitlab-runner" flakm/gitlab-runner-auto-register:latest register --help Copy
🌐
Awsworkshop
gitlab.awsworkshop.io › 050_lab_2 › 52_runner.html
Install and register Runner :: MP DevOps Series
You will be prompt to enter registration token, copy it from the Runner settings. Paste it in the console. Enter Description for the runner: type GitLab workshop. ... Enter executor, type docker.
🌐
Datawookie
datawookie.dev › blog › 2022-03-23-pre-registered-gitlab-runner-in-a-container
Pre-Registered GitLab Runner in a Container – datawookie
March 23, 2022 - FROM gitlab/gitlab-runner:v14.7.0 RUN apt-get update && \ apt-get install -y docker.io COPY gitlab-runner-register.sh .
🌐
GitLab
docs.gitlab.com › gitlab docs › administer › administer gitlab runner
GitLab Runner | GitLab Docs
Enables caching of Docker containers. Seamless installation as a service for GNU/Linux, macOS, and Windows. Embedded Prometheus metrics HTTP server. Referee workers to monitor and pass Prometheus metrics and other job-specific data to GitLab. This diagram shows how runners are registered and how ...
🌐
GitLab
docs.gitlab.com › gitlab docs › administer › administer gitlab runner › runner executors › docker
Docker executor | GitLab Docs
The Docker executor uses Docker Engine to run each job in a separate and isolated container. To connect to Docker Engine, the executor uses: The image and services you define in .gitlab-ci.yml. The configurations you define in config.toml. You can’t register a runner and its Docker executor ...
🌐
Medium
vineetcic.medium.com › registering-gitlab-runners-2f78703d024e
Registering GITLAB-Runners. Registering a Runner is the process… | by Vineet Kumar | Medium
July 30, 2021 - Make sure to restart the whole container instead of using gitlab-runner restart: docker restart gitlab-runner · One line Registration command with docker excecutor: docker run --rm -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register --non-interactive --executor “docker” --docker-image alpine:latest --url “https://mygiturl.com/" --tls-ca-file “/etc/gitlab-runner/certs/ca.crt -n” --registration-token “XXXXXXX” --description “docker-runner-MYFIRST-RUNNER” --tag-list “docker” --run-untagged=”true” --locked=”false” --access-level=”not_protected” --docker-privileged
🌐
GitHub
github.com › phihos › docker-gitlab-runner
GitHub - phihos/docker-gitlab-runner: A dockerized GitLab runner that automatically registers before running. · GitHub
docker run --detach \ --name gitlab-runner \ --restart=always \ -e REGISTRATION_TOKEN=XXXXXXXXXX \ -e CI_SERVER_URL=http://gitlab.mydomain.com \ -e RUNNER_EXECUTOR=shell \ -e RUNNER_SHELL=bash \ --volume /etc/gitlab-runner:/etc/gitlab-runner \ phihos/gitlab-runner
Author: phihos
🌐
GitLab
gitlab.com › gitlab.org › gitlab-runner › repository
docs/register · c10ce6cbc1d24399be9cb2911d524708b2d69889 · GitLab.org / gitlab-runner · GitLab
If you're running the runner in a Docker container, run the register command with a structure similar to the following example: docker run --rm -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register \ --non-interactive \ --executor "docker" \ --docker-image alpine:latest \ --url "https://gitlab.com/" \ --token "$RUNNER_TOKEN" \ --description "docker-runner"
🌐
YouTube
youtube.com › watch
How to register & run GitLab Runner inside a Docker container
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
🌐
Programster
blog.programster.org › deploy-gitlab-runner-with-docker
Deploy Gitlab Runner With Docker | Programster's Blog
May 4, 2026 - This uses the docker socket binding ... other methods if you like. REGISTRATION_TOKEN="" URL="" gitlab-runner register -n \ --url $URL \ --registration-token $REGISTRATION_TOKEN \ --executor docker ......
🌐
TestDriven.io
testdriven.io › blog › gitlab-ci-docker
Deploying Self-Hosted GitLab CI Runners with Docker | TestDriven.io
October 29, 2021 - Run the following command to register a new runner, making sure to replace <YOUR-GITLAB-REGISTRATION-TOKEN> and <YOUR-GITLAB-URL> with your group's registration token and URL: $ docker-compose exec gitlab-runner-container \ gitlab-runner register \ --non-interactive \ --url <YOUR-GITLAB-URL> \ --registration-token <YOUR-GITLAB-REGISTRATION-TOKEN> \ --executor docker \ --description "Sample Runner 1" \ --docker-image "docker:stable" \ --docker-volumes /var/run/docker.sock:/var/run/docker.sock