Hey, I know it's late answer, but someone may encounter the same problem mentioned above. Mainly, when CMD ["cron", "-f"] is run, it makes the Dockerfile stuck on that command because of the -f flag, and that's why we cannot access the system via browser. A solution would be the following:
Create your custom entrypoint.sh, something like this:
Hey, I know it's late answer, but someone may encounter the same problem mentioned above. Mainly, when
CMD ["cron", "-f"]is run, it makes the Dockerfile stuck on that command because of the-fflag, and that's why we cannot access the system via browser. A solution would be the following:Create your custom entrypoint.sh, something like this:
#!/bin/bash
cron -f &
docker-php-entrypoint php-fpm
Note the &, it means "send to background".
Then:
COPY ./entrypoint.sh /
ENTRYPOINT /entrypoint.sh
With that, we redefine our entry point of php-fpm, and since the cron starts as a background process, we can make it work simultaneously.
Source: https://stackoverflow.com/questions/44198700/getting-cron-to-run-on-php7-fpm-image#answer-44201082
Additionally, try running
/usr/sbin/cron -finstead ofcron -f, if the scheduled job still doesn't work.