use this script as cronjob. do not try to enable cron inside the contaier. inside any container.
so you just add docker exec --user www-data nextcloud php occ preview:pre-generate
assuming that your container name is nextcloud and www-data the web server user.
just saying.
this is a way to enable crond inside a container.
exec
executes everything you use as the first argument. e.g. a shell skript has no +x bit. exec that-skript
is your friend. and busybox crond
just starts the cron daemon inside the container.
nevertheless after i wrote the comment above i found this article in german Projekt Rootserver - geschlossen it says: don’t do it with busybox. not a good idea. the authors advice: use the host cron + docker exec