I am relatively new to using docker (used to use vbox). I have managed to learn a little and setup a local development environment for myself. So, bear with me in understanding things.
Now, the problem I have just run into, is that I can’t seem to get cron running either on one of my existing containers or as a separate container. At first, I tried just installing cron on an existing container that is hosting the site I am developing (code is on a volume so I can constantly edit/refresh). I couldn’t get the cron service to autostart, but wasn’t concerned if I had to start it manually whenever I was working. However, it never seemed to run my script.
My second and third attempts were solutions I found online for basically running a separate container for just cron. Both of these seemed like it should work. I could go in to the container and see cron was running, the code was there and if I ran the command manually everything was fine. However, I would sit waiting and nothing would ever seem to happen.
So, my question is - does anyone have a definitive way to do cron for just some local development?
My cron file is just this (should run every 5 minutes):
*/5 * * * * php /path/to/cron.php >/dev/null 2>&
cron.php simply appends the current time on a newline in a file.
The latest method that I tried was like this (where everything seems to work, but doesn’t do anything): https://github.com/hchstera/docker-alpine-php-cron
This method seems a bit more convoluted then some others, but none so far have worked.