DEV Community

keinzeit
keinzeit

Posted on

running a gitlab runner on docker

running the following commands in Git Bash on a Windows machine:

  1. run docker pull gitlab/gitlab-runner: this pulls the Gitlab Runner image found on Docker Hub. it's managed by Gitlab themselves

  2. run this command:

docker run -d --name gitlab-runner --restart always \
  -v /srv/gitlab-runner/config:/etc/gitlab-runner \
  -v /var/run/docker.sock:/var/run/docker.sock \
  gitlab/gitlab-runner:latest
Enter fullscreen mode Exit fullscreen mode

it creates a container based on the Gitlab runner image we pulled in step one, and it mounts certain configuration files in the container to the local system volume so that they persist upon restart of the container (probably super useful if i'm running the container on my local machine, since i'll be turning that computer on and off a lot)

  1. run this command to register the runner: winpty docker run --rm -it -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register
  2. original instructions on Gitlab docs don't have the winpty, i added it after Git Bash told me it wasn't a TTY and that I should try adding it

  3. what i passed to the interactive CLI:

  4. gitlab instance url (found under Settings > CI/CD > Runners)

  5. registration token (also found under Settings > CI/CD > Runners)

  6. runner description (local docker container runner)

  7. tags (debug, setup)

  8. optional maintenance note (left blank by simply hitting Enter)

  9. executor (docker)

  10. default Docker image (gitlab/gitlab-runner:latest)

nicee

now let me try changing the runner of my branch to the new, dockerized runner i just set up

actually, i'm not sure if i can do that. let me try running the pipeline again and see if it can execute now that i have a runner setup - OH SHOOT IT'S RUNNING - nevermind, it's stuck still

ohhh this is enlightening: https://docs.gitlab.com/ee/ci/runners/configure_runners.html#set-a-runner-to-run-untagged-jobs
runners only run on tagged jobs. mine was likeiy not tagged at all. maybe i can either

  • tag a job with the tags i gave my runners
  • set a runner so that it can be used for untagged jobs

i'm trying the 2nd option

from this post, seems like you specify the tag in the .gitlab-ci.yml. pipelines will run on all runners with those tags

i tried adding the following code snippet to each of my jobs:

tags:
 - debug
Enter fullscreen mode Exit fullscreen mode

still gets stuck

ugh. at this point, i just wanna nuke everything and try anew.

gonna explore the Gitlab Runner docs to see what i can find

Top comments (0)