In addition to what Mantas said, I'd suggest reading man systemd.special. and https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/ This should give you an idea what network-online.target is supposed to be. It's not a target to hook arbitrary services into (via WantedBy). Your service looks like multi-user.target is a better fit. Stuff like NetworkManager-wait-online.service or systemd-networkd-wait-online.service is something which should hook into network-online.target via WantedBy. Am Di., 22. Dez. 2020 um 14:17 Uhr schrieb Mantas Mikulėnas <grawity@xxxxxxxxx>: > > On Tue, Dec 22, 2020 at 1:36 PM Ronald Wimmer <ronaldw@xxxxxxxx> wrote: >> >> On a server running OL 7.9 with SystemD 219 we have a custom SystemD >> service we have something like >> >> >> [Unit] >> Requires=network.target docker.service >> >> [Service] >> Restart=always >> RestartSec=10 >> TimeoutSec=300 >> WorkingDirectory=/data/someapplication >> ExecStartPre=<pull a docker image> >> ExecStart=<docker-compose up> >> ExecStop=<docker-compose stop> >> ExecStopPost=<docker-compose down> >> >> [Install] >> WantedBy=network-online.target >> >> which does not work. This service leads do several other services >> (rsyslogd, docker, network-online.target, ...) to be stuck in "start >> waiting". >> >> My question is why? Is there any obvious misconfiguration in the service >> above I am too blind to see? > > > As a special case, when a target has Wants= for some unit, it will automatically add an After= as well. (So from your unit's point of view, you have [Install] WantedBy=network-online.target, so you can imagine that you automatically have a Before=network-online.target as well – unless you explicitly specify the opposite.) > > However, Docker has "After=network-online.target", so you end up creating an ordering loop: > > * yourthing.service has no After=, but it runs `docker` commands and cannot finish until docker.service is up; > * docker.service explicitly has After=network-online.target and won't start until that target is reached; > * but network-online.target has an implicit After=yourthing.service (as explained above). > > -- > Mantas Mikulėnas > _______________________________________________ > systemd-devel mailing list > systemd-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/systemd-devel _______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel