Entrypoint of systemd container for Gitlab CI

Viewed 24

I'm building a docker image for running Gitlab CI jobs. One of the components needs systemd up and running inside the container, this is not trivial but there are several guides on the web so I managed to do it. Part of the process requires to define this entrypoint in the Dockerfile:

ENTRYPOINT ["/usr/sbin/init"]

so that systemd runs as PID 1 in the container, as needed. This seems to conflict with Gitlab CI requirements: as far as I understand gitlab-runner overrides the Dockerfile's CMD to spawn a shell which then executes the CI script. But the /usr/sbin/init entrypoint cannot understand the Gitlab's CMD so the shell is not spawned and the execution halts.

I cannot figure out how to solve this:

  • executing an entrypoint script which starts /usr/sbin/init and then a shell won't work because systemd won't be PID1;
  • using a shell as ENTRYPOINT and then systemd as CMD won't work since Gitlab CI overrides CMD.

I cannot think of any other possible solution, so any help is much appreciated.

0 Answers
Related