How to get other users data in docker?

I have installed Nextcloud server by using Docker. How can I get other users’s data like their message and their files in my server. I try opening the file html/data/user but it says “Error: Cannot show content of /var/www/html/data/user1 (not regular file)”

Would be easier to answer your questions, if you had provided your docker run command or your docker compose file.

Files are stored in the respective user directory, messages are stored in the database.

https://github.com/docker-library/docs/blob/master/nextcloud/README.md#persistent-data

Try /var/lib/docker/volumes/... on your Docker host.

1 Like

I didn’t use docker compose, just installed it with the apache image by running this command.

$ docker run -d -p 8080:80 nextcloud

OK if I use SQLite, which directory should I look at?

That docker run command has no volumes assigned so you don’t have any persistent data. If you restart the container you will lose any data contained within it.

If you have any data you need to keep in that container you will have to use the docker cp command, and copy any files out of the container so you can add they to a persistent volume storage.

But it still contains data in some files, right? So which files is that? I just need Nextcloud for my uni project so I don’t think persistent data matters to me.

Again, the data should be on your host, not in the container. Please read what is written in the link from my previous post, especially the part at the very beginning:

The Nextcloud installation and all data beyond what lives in the database (file uploads, etc.) are stored in the unnamed docker volume volume /var/www/html. The docker daemon will store that data within the docker directory /var/lib/docker/volumes/.... That means your data is saved even if the container crashes, is stopped or deleted.

So there should be an “unnamed” directory in /var/lib/docker/volumes, containing all the data of your Nextcloud installation.

Because I was courious I spun up a container myself using the same command as you, and I found all the data in…

/var/lib/docker/volumes/e18c78fee9165892690d6b1778fe775a1a9aa6b465c642d2ac64973048e8c335/_data

The long string is the name of that “unnamed” directory, and will probably be a different string on your system.

There are further subdirectories inside that directory:

  • The SQLite database is in a file named owncloud.db in _data/data/

  • Files are in _data/data/<username>/files/

Hope that helps.

Thanks, you’re my savior. I find all the files in the _data/data/<username>/files/ and the chat message of all users in oc_comments table in SQLite databse file, in my case, it’s the nextcloud db file in _data/data/