I have a web app running in a docker container (apache, php). I've been looking for solutions to install a cron job in order to regularly perform some actions on my web app (execute php files etc).
I found multiple answers (How to run a cron job inside a docker container?), all based on creating a separated container which will be responsible to run the cron jobs.
Now, how do I make this cron container communicate with my web container ?
I found multiple solutions :
- Install and use CURL on my cron container
- Install cron on web container and run it in the background (against good practices)
- I'm also wondering if I could use a shared network in my compose file between my web and my cron container, but I'm unsure on how to make it work.
Do you guys have other ideas or code samples to help me achieve this ?