Closed J0WI closed 6 years ago
I would be against that. The whole reason of using Docker or LXC (or at least, one big reason) is to be host independent. Meaning that anyone can just execute a "docker-compose up -d" and it just works, without further configurations. And you are now trying to make it again host dependent. That kind of defeats the purpose (IMO)
By default NextCloud uses AJAX Cron anyway. So docker-compose up -d
will still work for you as before.
A lot of certified images are actually working like this. Some examples: https://github.com/docker-library/official-images/pull/1203#issuecomment-189392751 https://github.com/docker-library/wordpress/issues/157#issuecomment-356448137 https://github.com/docker-library/postgres/issues/353#issuecomment-335215407
By default NextCloud uses AJAX Cron anyway
That I do know. I was referring to the
create a cronjob or Systemd timer on the host
part, which I strongly disagree, for the aforementioned reasons.
@J0WI why would you use a lightweight php-cli container. The lightweight container needs at least all the nextcloud dependencies. If you for example use the php:7.1-cli image and install the dependencies you add about 150MB, which i would not call lightweight.
If you add cron to the image it adds about 2MB. Which should not be a big problem for the people who do not use it.
@tilosp you're right, that fails. But how do you think about the docker exec
solution?
But how do you think about the docker exec solution?
I see it as an option. But there are situations were you do not have access to system cron or do not want to use it. So the extra 2MB won't hurt anyone. And by the way on alpine it only adds 62 Bytes, because busybox is installed on the alpine base image.
Also worth considering: with the current design, cron.php
executes background tasks directly (e.g. sending mail), so it needs access to all the same code, volumes (data), and networks (e.g. mail server) as the main (nextcloud) container.
The current behavior of Cron inside the NextCloud image does not make much sense to me. In the current example the whole NextCloud container is started in a second instance, that runs Cron. ~But I can also use a very lightweight php-cli container and run the PHP command with an additional
sleep
.~ Since most containers are running on a host system or Kubernetes it's even simpler to create a cronjob or Systemd timer on the host that runsdocker exec -u www-data my-nextcloud php cron.php
.Would you accept a PR to remove Cron from the image and update docs and examples?