I don’t have detailed answers for all the questions. just see a working solution from my setup:
- additional cron container has same settings as app container (image, ENV, volumes, DB connection)
- the only difference is the entrypoint, this is
entrypoint: /cron.sh
this results in cron.php running with access to files and DB so it can perform background tasks of the instance
docker-compose example:
dev-nextcloud-cron:
image: nextcloud:23.0.1
container_name: dev-nextcloud-cron
restart: unless-stopped
env_file:
- ./nextcloud.env
- ./db.env
volumes:
- ./app:/var/www/html
- ./files:/var/www/html/data
- ./config:/var/www/html/config
entrypoint: /cron.sh
depends_on:
- dev-nextcloud-app