I set up nextcloud by this command: docker run --name nextcloud -p 9980:80 -itd --link nextcloud_psql:nextcloud_psql --restart=always -v /mnt/raid1/:/data docker.io/nextcloud
After setting up, nextcloud are not showing any of the files that I have mapped by -v/mnt/raid1/:/data in the webui. But
docker exec -it nextcloud bash
cd /data
ls -la
Can show all the data I have.
I have tried occ files:scan --all but that didnt work.
Is this a new installation or one that’s been functioning? (i.e. you’ve accessed these files, mounted in this way, from NC)
You can’t check permissions or run occ commands properly as root. You need to be appending -u1001 to your exec commands from the looks of the permissions you provided.
The permissions and ownership of all the subdirectories under data matter as well. Check them. You’re more likely to encounter these issues since you’re using bind mounts rather than naked volumes. Bind mounts | Docker Documentation
Update: Actually now that I look at it closer your file permissions are definitely not right. The 1001 should match an id recognized by the docker container. Usually that’d be www-data/33.
It is a new installation on Docker.
I have ran occ with -u 33 as recommanded when I ran occ with the default user:
root@6d68d80827ab:/var/www/html# ./occ
Console has to be executed with the user that owns the file config/config.php
Current user id: 0
Owner id of config.php: 33
Try adding 'sudo -u #33' to the beginning of the command (without the single quotes)
If running with 'docker exec' try adding the option '-u 33' to the docker command (without the single quotes)
This will use your /mnt/raid1 as your Nextcloud data directory (a persistent bind volume in Docker) and will also tell Docker to create a persistent internally managed named volume to store your Nextcloud configs/apps.
Also, as an aside but possibly a timely one: I would suggest you explore switching to using a Docker Compose file for your stack so it’s less fragile (and way easier to keep sane).
Okay I fear my sleepiness is making this less clear than I’d like so I cleaned this post up of most of the rambling hah.
You’re nextcloud.log will likely tell you the issue.
However since you previously started the same container differently you may simply have inconsistent stuff around. Since this was a fresh install I assume there was nothing of importance in the nextcloud container you ran with the prior mount point, correct? If so:
docker stop nextcloud
docker rm nextcloud
Then reattempt the docker run [...]
I’ll make two other suggestions:
You probably don’t want -itd but I’m not sure of your goals. Generally I’d expect just -d. Combining all three is somewhat mutually exclusive.
Consider using a Docker Compose file instead of running and defining all this stuff manually. It will make your stack easier to configure, update, and keep straight.