Nextcloud Docker Volume Structure

Hello everyone,

I’ve installed Nextcloud using Docker (not AIO).
In our environment, we are running separate containers for Nextcloud, MariaDB, and Redis.

Currently, I am using one volume for Nextcloud mounted at /var/www/html and another one for MariaDB. However, I am unsure whether mounting the entire /var/www/html directory is the best approach.

My concern is that if the Nextcloud installation resides inside the volume, updating the container image might not update the Nextcloud core files, since the volume would override the files provided by the image. In that case, would Nextcloud still handle the update process correctly when everything is stored inside a volume?

Additionally, this setup appears to use more storage, as the initial data from the image is copied into the volume.

Would it be better to use separate volumes instead of mounting the entire /var/www/html directory? For example:

/var/www/html/data
/var/www/html/config
/var/www/html/themes
/var/www/html/custom_apps

I would appreciate your advice on best practices for this setup.

Thanks in advance for your help.

I presume you’re referring to the micro-services image? (there are various Docker images besides AIO; though only one other that is hosted within the project itself).

The image’s entrypoint handles this situation. In fact it expects it so it’s not a problem.

In that case, would Nextcloud still handle the update process correctly when everything is stored inside a volume?

Yes, this is a typical deployment.

Would it be better to use separate volumes instead of mounting the entire /var/www/html directory?

That’s mostly up to you. There’s not any practical benefit if they’re all ultimately stored on the same underlying storage on your host.

See Persistent data for specifics.

1 Like