I’ll start off by explaining what i eventually want to accomplish:
- Have a gitlab-runner instance running inside a docker container that I can share with people working on the same repository.
- This docker container should have all the dependencies for the project met, and should be able to run our project
- The goal will eventually be to have a CI/CD Pipeline using a docker container on either my machine or someone else’s. We are all working on forked repos, so it would be most helpful to have the pipeline run in the parent repository, right before a Merge Request is merged.
Describe your question in as much detail as possible:
I began this process by downloading the
gitlab/gitlab-runner:latest docker container. Then, I used this Dockerfile and these scripts(Script1- Package Installation, Script2 - Build Script) to get everything set up. Once I mangled my way through
apt-get install and everything looked right, I ran the following command on my computer (host machine) and got a docker container that could compile my project:
sudo docker build -f ./Dockerfile . -t gitlab/gitlab-runner:game-build
Once I run this, I get the following as output:
sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE gitlab/gitlab-runner game-build d654b3963ee4 2 minutes ago 1.38GB gitlab/gitlab-runner latest a0153b77b0da 20 hours ago 461MB
From the output of the build command, I can verify that the project did in fact build.
Now that I’m confident the project can build inside the container, I moved to trying to run the container
gitlab/gitlab-runner:game-build as a pipeline runner.
I attempted to follow this guide (Runner Registration), I ran the following command:
sudo docker run --rm -it -v /srv/gitlab-runner/config:/etc/gitlab-runner \ gitlab/gitlab-runner:game-build register
During this process, I ran through the registration process, and successfully see my docker container as a registered runner in my project CI/CD settings. However, as you can see below, in the settings, I have a warning sign (when hovering over, it reads "New Runner, has not connected yet).
When I attempt to run the docker container using
docker run <options> gitlab/gitlab-runner:game-build, I get the following as output, but then I don’t see any update to the Gitlab CI/CD interaface (it’s running, but I can’ t seem to have it connect)
sudo docker run gitlab-runner:game-build Runtime platform arch=amd64 os=linux pid=456437 revision=353dd94e version=13.2.0 Starting multi-runner from /etc/gitlab-runner/config.toml... builds=0 Running in system-mode. Configuration loaded builds=0 listen_address not defined, metrics & debug endpoints disabled builds=0 [session_server].listen_address not defined, session endpoints disabled builds=0
What do I need to do to have my docker container connect to the gitlab server? I’m not sure how to go into the docker and see if the
config.toml is there, since the container is not interactive.
As a side question, how can I make it so that the docker container spawns a shell? I ask because it has been very difficult to debug docker commands without some way of verifying installation paths interactively through a shell… Is there a way I can make a shell spawn with the gitlab-runner container?
Thanks for taking the time to be thorough in your request, it really helps!