Can't create or write into the data directory /var/www/nextcloud/data/

I’ve seen numerous accounts of this same error but though I have attempted to apply many ‘solutions’, nothing is working for me yet. I need advice.

I installed docker (never used it before).
sudo apt install docker.io

I created a user in mysql (from a pre-existing and functional LAMP install), then used that user to create my db for nextcloud.

I created directory ‘nextcloud’ with subdirectory ‘data’ in /var/www.
Made sure to change ownership to www-data for both (permissions 755 or drwxr-xr-x)

Then did an install of nextcloud based on what I read on the github nextcloud docker page.
docker run -d -p 8787:80 -v nextcloud:/var/www/nextcloud/data nextcloud

I browsed to localhost:8787.
Entered credentials and … error.

Help? Is there an obvious problem I’m missing?
I didn’t find any indication of the files installed anywhere (not in /bin/, /usr/bin/, /usr/share/, etc… none of the usual places). Maybe the installation just didn’t go? But if so, where is the web page being served for localhost:8787?

Try in/var/lib/docker/volumes/... my reading of that docker page and what you have posted suggests you are attempting to use a named volume but you haven’t actually defined where that volume lives.

Alternatively you can link directly to a folder:

docker run -d -p 8787:80 -v /var/www/nextcloud-host/data:/var/www/nextcloud/data nextcloud

1 Like

Thanks @dugite-code, that does give me a bit more insight into Docker containers.

But as I worked through it I asked myself the question I’m surprised that no one else has asked. If you already have LAMP set up and running, and if nextcloud is just a web app, then why not just create a new website?

I could not make enough sense of the containers to want to continue there today. Perhaps in the future when I revisit docker for my own uses (?). For today I will change course and leave this as an abandoned question.

Thanks for the help.