3

Is it possible to start services on and post startup in CentOS/Fedora distributions without using systemd (systemctl)? If yes, how?

Systemd does not work in non-privileged docker containers; consequently at this point I can only start services within privileged containers, which I'd prefer not to do.

Thanks.

  • You could use a cronjob with the @reboot trigger if your cron supports that feature. – Marco Feb 26 '15 at 18:37
  • Or you can do something in the login shell: pgrep somed || somed... This obviously only works if you login with a shell, though... – Martin Tournoij Mar 3 '15 at 16:58
3

There is an excellent project -- docker-systemctl-replacement where you can get alternative systemctl command to start/stop services without systemd.

systemctl replacement is not a complete re-implementation of original systemctl but it works fairly well in practice.

It can be installed as follows:

wget https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py -O /usr/local/bin/systemctl
0

Generally, the model right now is to just start your application directly as the single process in the container. This approach has its flaws, but also seems to be the current main thinking of containerization efforts.

The other models — containers as something more like a lightweight vm, with more supporting infrastructure running — is useful too, but currently we (I work on Fedora) don't have a built-in / predefined model for multi-service containers other than systemd. The goal is eventually to make systemd work in unprivileged containers too. (See Container Interface spec for upstream plans, or this post from Dan Walsh giving a quick update of work in Fedora.) In the meantime, some people have hacked it into working — see this blog post for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.