Search code examples
dockergitlabgitlab-ci-runnerpodman

How to setup gitlab-runner in a podman container to use the executor option docker (to use podman)


Using podman run and setting up the gitlab-runner works withoud a problem. However, how does one now set the executor to use podman? Shell works, but this isn't as clean as using the docker executor.

Does anyone have an idea how to set the gitlab-runner container to use this executor?


Solution

  • I had to mount the following socket as a volume: /var/run/podman:/var/run/podman (no need for :Z on selinux). This won't be enough as the permission from the container side will only be ?. To fix this add the following security opt: label:disable.

    After you setup the pod, go through the registration and choose docker. Once it registered edit the config.toml with the following:

    host = "unix:///var/run/podman/podman.sock"

    You do not need to use privileged anywhere inorder to make gitlab-runner work.