<div dir="ltr"><div dir="ltr">On Tue, Dec 22, 2020 at 1:36 PM Ronald Wimmer <<a href="mailto:ronaldw@ronzo.at">ronaldw@ronzo.at</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On a server running OL 7.9 with SystemD 219 we have a custom SystemD <br>
service we have something like<br>
<br>
<br>
[Unit]<br>
Requires=network.target docker.service<br>
<br>
[Service]<br>
Restart=always<br>
RestartSec=10<br>
TimeoutSec=300<br>
WorkingDirectory=/data/someapplication<br>
ExecStartPre=<pull a docker image><br>
ExecStart=<docker-compose up><br>
ExecStop=<docker-compose stop><br>
ExecStopPost=<docker-compose down><br>
<br>
[Install]<br>
WantedBy=network-online.target<br>
<br>
which does not work. This service leads do several other services <br>
(rsyslogd, docker, network-online.target, ...) to be stuck in "start <br>
waiting".<br>
<br>
My question is why? Is there any obvious misconfiguration in the service <br>
above I am too blind to see?<br></blockquote><div><br></div><div>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.)</div><div><br></div><div>However, Docker has "After=network-online.target", so you end up creating an ordering loop:</div><div><br></div><div><div></div><div>* yourthing.service has no After=, but it runs `docker` commands and cannot finish until docker.service is up;</div></div><div>* docker.service explicitly has After=network-online.target and won't start until that target is reached;</div><div>* but network-online.target has an implicit After=yourthing.service (as explained above).</div><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>