Per this question and its answers, I've added the following to my service file:
Wants=network-online.target
After=docker.service network.target network-online.target
I've also run:
systemctl enable NetworkManager-wait-online.service
systemd-networkd-wait-online.service
And yet my ExecStartPre
task which uses git pull origin master
still fails because of what appears to be a connectivity issue.
Mar 22 16:17:21 COMPUTER git[1983]: ssh: Could not resolve hostname github.com: Name or service not known
Mar 22 16:17:21 COMPUTER git[1983]: fatal: Could not read from remote repository.
Am I missing something obvious? Is there another service I need to wait for in order to use git pull
? (In case it's relevant, I'm using Ubuntu 16.10 and systemd 231.)
network-online.target
. Possibly you will need to make your unitAfter=NetworkManager.service
(orAfter=NetworkManager-wait-online.service
).