I’d need to understand how does gitlab-runner create the docker container using the docker executor. I am asking because my CI image contains systemd as ENTRYPOINT, and starting it manually with
docker run produces a correct initialization and the systemd “boot” process ends up with multi-user.target, starting also the units that manage the processes I’m interested in. Instead, using the same image for running a CI job with gitlab-runner ends with systemd hitting the rescue target and finally with a non-working system since my units are not started. Here’s how I launch the container in the two cases:
sudo docker run -i --rm --name test --tmpfs /tmp:rw --tmpfs /run:rw -v /sys/fs/cgroup:/sys/fs/cgroup:ro --env container=docker my-image:latest
sudo gitlab-runner exec docker --docker-tmpfs /run:rw --docker-tmpfs /tmp:rw --docker-volumes "/sys/fs/cgroup:/sys/fs/cgroup:ro" --env container=docker my-build-job
where of course
I cannot understand what might differ in container creation between the two cases that makes systemd enter rescue mode when using gitlab-runner; no failed unit is reported when using gitlab-runner, and inspecting the systemd logs and the docker containers gives no evidence of what might be wrong (I can post the logs if someone is interested to take a look). So I decided to change approach and seek for differences in container creation commands, but I cannot find anything sufficiently detailed about gitlab-runner’s container instantiation.
Any help would be greatly appreciated. Using gitlab-runner 15.3.0 (bbcb5aba).