Gitlab Runner has been deployed inside the Docker container. At some point, there was an idea to assemble all the necessary infrastructure (for example, PostgreSQL and Tomcat) inside one container for installing the application after the compilation stage and running the autotests. The infrastructure container itself was already built based on the Debian image with Systemd and worked fine. But when used inside Runner, unexpected problems began. The step code was for simplicity, let it be:
run-autotests: image: debian/systemd before_script: - cp backend.jar /opt/ - cd /opt script: - java -jar autotests.jar
Everything seems to be normal, but at startup the step will fall down with an error that systemd is not started as a process with ID 1 or perhaps another error will be that systemd is not started at all.
What would seem to be the problem?
As it turned out - on a fresh issue at the very Gitlab, I am not the only one who ran into this problem.
The problem is that the Gitlab Runner for Docker container always rewrites the CMD command, i.e. starts the container with this command:
docker run --cmd /bin/bash ...
And it is impossible to redefine the Hitlab CMD, you can only use the entrypoint inside the ci script, but dances with it lead nowhere.