I am looking for best practices about running cronjobs for my php fpm container.
Right now running:
- NGINX Container
- PHP FPM Container
- MySQL Container
I now would love to have another Container running called "Cronjob Container" who exec`s a script within my PHP FPM Container ( I need some dependencies of PHP ).
So three possible solutions:
1.) Running an own container
I would love to use this solution!
It would be good to have a container running CRON where I am able to ( somehow ) call docker exec on my php fpm container... Or have another way.
2.) Running CRON inside of PHP Container
This would be okay, but is not best practice. I could start a second process inside my php fpm container running cron. This would work but I am not sure if this is who you should work with docker.
3.) Running Hosts Cron
This would be cruel. I would need to find the processID and containerID of a given path and then run docker exec. But this is more or less my last way... And I hate to manage cronjobs without of deployment.
So what is the best approach here?
Have a nice day,
Bastian
docker run --rm --name web2 --link db:db training/webapp commandname
, so if that does work for you, run cron in one container, and have it issue commands like that on the other container(s).