Cron when in docker


#1

Hello,

I installed nextcloud in a docker container, with the official image.
However, when in the web gui I change the cron type from AJAX to Cron, well, it doesn’t actually switch to CRON (as can be seen by the time log fo cron jobs).

There are instructions on how to switch to cron by actually setting up cron on a full system, but didn’t found how to do it for a container.

I guess I could log in the container and create the cron job there, but I’m more looking for options to pass in the docker-compose.yml to enable it - if it has been provisionned. Wonderfall’s version seem to have it, with the parameter in the YML on cron period. But I always prefer official images.

Thank you,
Nicolas


#2

I found I had to install cron manually in the container and even then I ran into config directory permissions issues. After solving those, it still doesn’t seem to be running.


#3

Did you solve the issue? I noticed, that nextcloud 13.5 is much faster, when I enable CRON in the settings, but it seems it doesn’t work out-of-the-box.

How do I enable cron inside the docker image, so this cron option will work?

I use the base version :


#4

You can enable cron in the webinterface settings and then set up a cron job on your host system for the docker, that calls this command every 15 minutes:

docker exec --user www-data nextcloud_app_1 php cron.php

call this as root:

crontab -e

and add this line:

*/15 * * * * /usr/bin/docker exec --user www-data nextcloud_app_1 php cron.php