The project runs under docker, and now there is a requirement for crontab. I want to add crontab under docker, but I can’t find it. How did the great gods who use docker add their own crontab to docker?
The project uses docker-compose 2.0
The system is equipped with ubuntu
The language is php7
1. install crontab in Dockerfile
etc/crontabThe file is mapped in. Of course, it can also be written directly in the Dockerfile.
3. Start the main application and crontab with supervisor
In fact, crontab is nothing more than installation, configuration and startup. The first two steps are done when you write build directly in Dockerfile. The key is how to start, because Docker only accepts one CMD and cannot start the main application and crontab at the same time. It is ok to use supervisor.