Automatically Generator Previews Docker Container

I am having some issues getting this app working on my Nextcloud installation via a Docker Container on my unRAID box.

Could someone please help me determine where to add this in order to automatically generate thumbnails on my photo gallery items?

Add a (system) cron job for ./occ preview:pre-generate

Thanks in advance.

  1. You have to inform yourself about cron (https://help.ubuntu.com/community/CronHowto)
  2. Add a line with a time pattern, user-info (www-data) and occ comand to your cron-file

Sorry for my ignorance. How does this work when Nextcloud is installed in a docker container? Would i setup the cron job on the host machine?

1 Like

Sometimes using google isn’t the worst idea (https://stackoverflow.com/questions/37458287/how-to-run-a-cron-job-inside-a-docker-container)

Hi there !
@chalk4, I know it’s been a long time since the last answer, but did you find a way to make it work ? I have the same problem with Nextcloud on OMV.
Thanks !

1 Like

Hi there!
I also had this problem. I couldn’t make cron task in docker, but I wrote command, which execute pre-generator from host machine.

You need use root crontab on host machine and create job:
* * * * * ~/cron_generator.sh

Text of “~/cron_generator.sh”:
PATH=$PATH:/bin:/usr/bin:/usr/sbin
SHELL=/bin/bash
docker exec -u 1000:1000 nextcloud bash -c “php /nextcloud/occ preview:pre-generate”

P.S. You can add task every minute, because you can’t execute more, than one instance. Or do it how you want)
P.S. In my situation, user 1000:1000 was owner of config.php. In your situation may be another, check it using ‘ls -la’
ENJOY!

I get a strange error:

Nextcloud is not installed - only a limited number of commands are available

Command “preview” is not defined.

…I played around with occ and when I do a status I get this:

Nextcloud is not installed - only a limited number of commands are available

  • installed: false
  • version: 20.0.1.1
  • versionstring: 20.0.1
  • edition:

When I do it with -u www-data I get this

Cannot write into “config” directory!
This can usually be fixed by giving the webserver write access to the config directory

Or, if you prefer to keep config.php file read only, set the option “config_is_read_only” to true in it.
See https://docs.nextcloud.com/server/20/go.php?to=admin-config

…so I guess it is about the right user …

with ls -la i see the owner and group (root and www-data) but what is the number?

thanks :slight_smile: