Cron for Nextcloud in Docker

AJAX wasn't cutting it, traditional crontab in containers doesn't make much sense to me, webcron is recommended but I don't want to register with anything outside my LAN... Turns out you can just spin up an identical container with a different entrypoint to / that does what you need!

Note that this is a task in an Ansible playbook - but the docker-compose is straight forward

So the only thing you need to make sure of is that all the configuration options - data volumes, user permissions, etc. are identical between the containers running the cron job and the one actually hosting NextCloud. This ensures that the container running cron has proper access to the database and filesystem - or at least the same access as NextCloud proper.

- name: Nextcloud Cron Docker Container
    name: nextcloud-cron
    image: ""
    pull: true
      - nextcloud-mysql:mysql
    entrypoint: /
      - "/nextcloud:/var/www/html:rw"
      MYSQL_HOST: "mysql"
      MYSQL_DATABASE: "nextcloud"
      MYSQL_USER: ""
      PUID: ""
      PGID: ""
      TZ: ""
    restart_policy: unless-stopped
    memory: ""