Does the Cron service need access to the same volume as the App service?

Hello,

I set up Nextcloud (mariadb, apache) via Docker Compose on my Raspberry Pi (RPI OS 11 64bit). The next step is setting up Cron.

I should take the example from the docker documentation, as follows:

  cron:
    image: nextcloud:apache
    restart: always
    volumes:
      - nextcloud:/var/www/html
    entrypoint: /cron.sh
    depends_on:
      - db
      - redis

However, as I was migrating from a non-docker installation and wanted to ease migration of data (and to make a back up/future migration of core data easy too) I set up the following Host volumes for the App container:

app:
    volumes:
      - ./config:/var/www/html/config
      - ./apps:/var/www/html/custom_apps
      - /nextcloud-data:/var/www/html/data

I assume (and from inspecting the running App container it seems) that the rest of the files that need to be in /var/www/html are there/taken from the image. (Is that correct - do image files get ‘overwritten’ by volume files?)

Now, for the Cron container I can think of several options, but I’m not sure what to do: I can apply the same Host volumes as the App container, not define a volume at all, or define an Anonymous volume. And maybe there are other options as well.

Would the Cron container need any files specific to my set-up? Might the apps that I installed write/assign ‘tasks’ to the cron job?

Any help/pointers much appreciated!

The cron container needs exactly the same volumes, variables and configs (e.g. DB) as app container. in other words it’s like a clone just running another command line (webserver is replaced by cron). more detailed discussion is here - try the search function it amazing :wink:

Thank you @wwe. I will have a look, should have looked better indeed.