Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 3 years ago.
I'm pretty new to docker. I've set up a dockerfile using the php:7-fpm image. As well as this image being used to run my site, I want to add a cron to be able to perform regular tasks.
I've created a cron, put it in the correct folder, and running docker exec -ti myimage_php_1 /bin/bash
then cron
or if I tail
the log file all works fine. But I can't get this to work when the container is created, I don't want to have to manually start the cron obviously.
From what I understand, I need to use CMD
or ENTRYPOINT
to run the cron
command on startup, but every time I do this it stops my site working due to me overriding the necessary CMD/ENTRYPOINT
functionality of the original php:7-fpm image. Is there a way to trigger both the cron command and continue as before with the php:7-fpm CMD/ENTRYPOINT
s?