docker-systemctl-replacement
docker-systemctl-replacement copied to clipboard
Generators support ?
Use case:
- install
docker-systemctl-replacement
v1.5.4260 on adebian:stable
docker container -
apt-get update
andapt-get install postgresql
-
systemctl start postgresql
I got the same result reported on issue #77, the systemctl shows the service is running, but no postgresql
process is running at all.
The workaround to get the service running was to use systemctl start postgresql@11-main
.
After going deeper in debian packaging of postgresql
to track the issue, I discovered the generators feature of systemd.
A script at /lib/systemd/system-generators/postgresql-generator
generates the service as a symlink:
/run/systemd/generator/postgresql.service.wants/[email protected] -> /lib/systemd/system/[email protected]
Actually, the whole template and generator features of systemd is a bad approach in the world of containers. If multiple instances of a service are needed then multiple containers should be started.
Nethertheless, template units do work - that's the [email protected]
part that you see. And the support is needed for some applications which only have the implementation of the start/stop in there.
Your workaround looks completely correct. You could flesh that out with using drop-in parts to patch the postgresql.service replacing the generator call with a direct symlink creation.
https://github.com/gdraheim/docker-systemctl-replacement/blob/master/EXTRA-CONFIGS.md
By the way, debian support is still missing in the examples which is the reason that I did miss the change. The sister project serves also as a test suite for real world services - and postgres is one of the main things that should work of course.
https://github.com/gdraheim/docker-systemctl-images
I have added test_318 to docker-systemctl-images and well, the setup for postgres ubuntu has a few differences.
https://github.com/gdraheim/docker-systemctl-images/blob/develop/ubuntu18-postgres.dockerfile