I want to run shell.sh in Ubuntu docker with apache and some services. This is my shell:
#!/bin/bash
/var/www/cron350.sh> /dev/null 2>&1 &
So in docker-compose.yml I add this command:
command: bash -c "/var/www/shell.sh && service php7.1-fpm start && service cron start && /usr/sbin/apache2ctl -D FOREGROUND"
I run "docker-compose up -d", however it doesn't work in the first time- everything is OK but the shell doesn't run. When I try to run "docker-compose up -d" again, the shell runs. Can you tell me why this happens? How can I fix it?
I'm so sorry because my English is not good.