When we use crontab or the deprecated /etc/rc.local , we need a delay (e.g. sleep 10 , depending on the machine) to ensure the availability of system services. Typically, systemd (or upstart ) is used to control which services start when the system boots. You can try using a similar configuration for this:
Or, if you want to run without -d :
Change the WorkingDirectory parameter to your docker project path. And enable the service to start automatically:
systemctl enable docker-compose-app
Oleg Belostotsky
source share