I think part of the problem is recreating the container with the same volumes, somehow it fails to set permissions on the existing config/data folders.
I've now used new folders and it gets me quite far. I can get through the setup part but now I'm stuck because the data folder isn't owned by nextcloud (based on logs), which causes the server to start in maintenance mode even though the maintenance mode parameter isn't set to true in the config file.
This link suggets doing chmod 0750 on the data folder but when I check permissions on the folder afterwards, nothing changed. How do I set the permissions correctly?
(The data folder is in the external hard drives root folder.)
OK I now know that it's not possible to change ownership of a mounted drive after mounting it if it's a non-posix/Windows file system (i.e. NTFS in this case). But is it possible to mount it with different permission for a subfolder? Assuming not, does that mean I need to mount it with the nobody user as the owner of the whole drive and then chmod so that the nextcloud data folder has has write access for other users but all other folders on the drive have rwx permissions for all users?
(I've never learnt about or played with linux permissions before so I could really use some help before I mess up permissions for all my other containers.)