Docker volume does not contain user data

With the latest Docker pi image (ownyourbits/nextcloudpi-armhf latest 104d6b23d24d) user data does not seem be be created under

/data/nextcloud/data/

but instead under
/data-ro/nextcloud/data/

Therefore the default docker mount option “-v /path/to/folder:/data” will not contain any user data.

Is this on purpose ? If so, what do you suggest, to mount user data ? Please also update the official doc, if you have updated recommendations.

Thanks
Michael

@mdr
Seems I have the same problem. The biggest issue is that the “/data-ro” folder is located in an overlay volume and backing up only the “/data” aka “ncdata” (host) folder will not lead to backup data of users… It seems something big changed :frowning: . Only backup from ncp panel is working.

This is a big problem if the volume was created on an external drive, like with “-v /mnt/extstore/ncdata:/data” and the admin believes that user data is stored there - no way. It will be stored in the overlays in /var/lib/docker/overlay2/l and this could be a different drive as well.

I’m running nextcloudpi as docker on a x86 machine.

So I moved my complete “data-root” in daemon.json of docker to the external drive but this could only be a temporary solution. Now also all overlays are on the external drive but this is not what it is intended for…

Sorry posted in wrong thread:

As reported https://github.com/nextcloud/nextcloudpi/issues/1227
I am not able to reproduce this.
Running (Mint18 host) docker inside a testVM (Ubuntu20)
pulling the latest image using -v to mount to local folder, works fine here

sudo ls /home/user/ncp/ncdata/nextcloud/data/
appdata_ocpa83zl7i7p files_external index.html ncp ncp-update-backups news nextcloud.log tmp

sudo ls ncp/ncdata/nextcloud/data/ncp/files
Documents ‘Nextcloud Manual.pdf’ ‘Nextcloud intro.mp4’ Nextcloud.png Photos

Container started with:

sudo docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v /home/user/ncp/ncdata:/data --name ncp ownyourbits/nextcloudpi-x86 192.168.0.11

Update:
Created and drag drop MyTestFile.md in NC’s webUI, and it was immediately visible in the local fs

sudo ls ncp/ncdata/nextcloud/data/ncp/files/Documents/
Example.md Example.odt MyTestFile.md ‘Nextcloud flyer.pdf’ Readme.md

@OliverV
Very strange… Thanks for checking. I will setup a new VM for mint 18 and for mint 20 and will try to install completelly new docker and nextcloudpi. And I will report here . Thanks again and have a nice Christmas - stay healthy.

@OliverV
Update: I installed a n VM with mint19.3 and mint20 to check if there is a dependency. In both cases the problem with “-v ncdata:/data” exists.

The user-added data are not stored in the external mounted path. So host user are not able to see the files there. He will find the added data in overlay2 folder like this:
./overlay2/15ed03935c11425e1354f333a67ab0cbe98f0542b4f14b148e6c4a29ebee5a37/diff/data-ro/nextcloud/data/ncp/files/file-added-by-user

Anyway I removed the special “data-root” change to another mounted drive, so docker installation is at default locations.

Steps where I can reproduce in mint19.3 and mint20 with latest nextcloudpi image:

#Tested on VMware® Workstation 15 Pro 15.5.6 build-16341506
 
#install mint 20
#wait and install updates
#install language packages
#install timeshift 

################################
# fix to install docker for mint 20 
################################
#install docker in MINT from https://computingforgeeks.com/install-docker-and-docker-compose-on-linux-mint-19/
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo "$UBUNTU_CODENAME") stable"
cat /etc/apt/sources.list.d/additional-repositories.list
sudo apt-get update
sudo apt-get -y  install docker-ce docker-compose
sudo usermod -aG docker $USER
####### RESTART MACHINE HERE or LOGOUT/LOGIN!!!!

##### run nextcloudpi container
sudo mkdir /mnt/my-server-backups
sudo chmod o=rwx /mnt/my-server-backups
docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v ncdata:/data -v /mnt/my-server-backups:/mnt/my-server-backups --name nextcloud.server ownyourbits/nextcloudpi-x86 my.domain.com

#activate with browser at 
https://127.0.0.1
#setup with browser some useful password for ncp (ncp panel and nextcloud) at
https://127.0.0.1:4443
# login with browser to nextcloud at
https://127.0.0.1
#as ncp
#add a folder e.g. "SCANS"
#enter the folder in browser and drag&drop a file into it

#open a terminal
sudo su
cd /var/lib/docker
# try to locate the "SCANS" folder you added to ncp user in nextcloud.
find -iname "SCANS"
# it is not in /var/lib/docker/volumes/ncdata or under this
# it is now located at something like this:
   ./overlay2/15ed03935c11425e1354f333a67ab0cbe98f0542b4f14b148e6c4a29ebee5a37/diff/data-ro/nextcloud/data/ncp/files/SCANS

My conclusion:
Docker’ed nextcloudpi now does not handle added data at data folder it is now stored in the a folder named data-ro.
Not sure if this is a problem of newest docker-ce (20.xxxxx) or nextcloud 20.0.2 or nextcloudpi image…

What I’m doing wrong? :thinking:

Update: Installed another VM with Ubuntu 20.10 running and appiled same setup as described before (without docker workaround) and got the same result: user data is not in the ncdata volume, it’s in the overlays stored in /var/lib/docker/overlay2/l … pointing to /var/lib/docker/volumes/AND_SOME_HASH_FILE_NAME_HERE…

As a new user here I only can add three answers here, but I can edit my answers :wink:
@cainbantam
Thanks that you post this here. So I’m not alone with it. :wink:
As I said I’m not sure if this is a problem of nextcloudpi, or nextcloud, or docker’s default overlay2 volume driver…

Same issue with last docker image for nextcloudpi-armhf. Its anoying for I mounted a btrfs luks crypted device especially to store the data and it is useless now… Is there something we can do to signal the issue in hope the developpers fix it?

Cheers!

is where things get messed up
it should look like :

-v /mnt/my-drive/ncdata:/data -v /mnt/my-drive/ncp-backups:ncp-backups

Afaik, You are not using the -v (volume) option correctly, so it gets disrecarded.
The “:” after each -v, devides the options, as in:

/path/to/ncdata/on/host:foldername (inside container)

Here is my run command and I still have the issue (at least as reported initially by mdr):
sudo docker run -p 4443:4443 -p 443:443 -p 80:80 -v /media/Nextcloud:/data --name nextcloudpi --restart unless-stopped ownyourbits/nextcloudpi-armhf $IP

Try creating a folder first at the mountpoint

sudo mkdir /media/Nextcloud/ncdata

then try again with

sudo docker run -p 4443:4443 -p 443:443 -p 80:80 -v /media/Nextcloud/ncdata:/data --name nextcloudpi --restart unless-stopped ownyourbits/nextcloudpi $IP

And check (and share, if need further support) the docker logs.

Hi,
thanks a lot for the help.
Unfortunately, it doesn’t work:
I wiped my nextcloud instance, the nextcloud image, docker, docker-engine, docker.io, docker-commons
I removed the files from the volume I mounted for nextcloud
I removed the folder /var/lib/docker
I reinstalled docker (curl -sSL https://get.docker.com | sh)
I made the /media/Nextcloud/ncdata as you suggested
I ran your docker run command above.
I initialized my new nextcloudpi instance and made users
I uploaded files with the nextcloud client…
And they all end up in:
/var/lib/docker/overlay2/2f921addb19838ff0ce46f875c8c9f17b1a29d1de65184c1540a360da25b3784/merged/data-ro/nextcloud/data/

Note that the ncdata folder I created isn’t empty. Above is what it contains if you wanna have a look.

Thanks again for considering this issue!

root@raspberrypi:/media/Nextcloud/ncdata# ls *
bin:
freedns.sh ncp-dist-upgrade ncp-suggestions
ncc ncp-notify-unattended-upgrade ncp-test-updates
ncp ncp-notify-update ncp-update
ncp-backup ncp-provisioning.sh ncp-update-nc
ncp-check-updates ncp-report nextcloud-domain.sh
ncp-check-version ncp-restore noip2
ncp-config nc-previews
ncp-diag ncp-scan

database:
aria_log.00000001 ibdata1 multi-master.info performance_schema
aria_log_control ib_logfile0 mysql tc.log
debian-10.3.flag ib_logfile1 mysql_upgrade_info
ib_buffer_pool ibtmp1 nextcloud

etc:
apache2 cron.daily cron.weekly services-enabled.d
cron.d cron.hourly letsencrypt shadow

ncp:
dnsmasq.cfg nc-hdd-test.cfg nc-scan-auto.cfg
duckDNS.cfg nc-httpsonly.cfg nc-scan.cfg
freeDNS.cfg nc-import-ncp.cfg nc-trusted-domains.cfg
l10n nc-info.cfg nc-trusted-proxies.cfg
letsencrypt.cfg nc-limits.cfg nc-update.cfg
modsecurity.cfg nc-maintenance.cfg nc-update-nc-apps-auto.cfg
nc-admin.cfg nc-notify-updates.cfg nc-update-nc-apps.cfg
nc-autoupdate-nc.cfg nc-passwd.cfg nc-update-nextcloud.cfg
nc-autoupdate-ncp.cfg nc-prettyURL.cfg nc-webui.cfg
nc-backup-auto.cfg nc-previews-auto.cfg no-ip.cfg
nc-backup.cfg nc-previews.cfg spDYN.cfg
nc-export-ncp.cfg nc-restore.cfg unattended-upgrades.cfg
nc-fix-permissions.cfg nc-rsync-auto.cfg
nc-forward-ports.cfg nc-rsync.cfg

nextcloud:
3rdparty console.php data occ public.php status.php
apps COPYING index.html ocm-provider remote.php themes
AUTHORS core index.php ocs resources updater
config cron.php lib ocs-provider robots.txt version.php

I’d remove docker .io and try :


or flavor you are using.
I use the “add repo” method, so it’s easy to update using apt.

@OliverV
Hmmm … I tested both options and for clearness I only used the recommended call here documented on the nextcloudpi website whereas “-v ncdata:/data” is mentioned.

My “-v ncdata:/data” is exact the same as described here:

I only added an additional external volume to get a backup path mounted to the container. To ensure that the second vloume mount of the backup volume is not the problem I removed it and got the same problems. I also tested then in addition with a absolute path and the problem raises again.

As docker docu tells, the -v option can take absolute paths or, if not absolute, it will be a local path under data-root of docker (e.g. /var/lib/docker/volumes. I tested both options and both results in storing data not in the ncdata path. The user-added data of the nextcloudpi container running will be stored in the overlays2 folder. And overlays seems to be stored in the data-root of docker…


To be clear: I setup now multiple VMs with Mint19.3 Mint20 Ubuntu 20.04 and Ubuntu 20.10 and a Ubuntu server on a Raspberry. Installed docker to the machines and did a “docker run” described here: https://hub.docker.com/r/ownyourbits/nextcloudpi

All showed the same result:
user-added data (by client or website) will not be stored in the ncdata volume. For sure inside of the running nextcloudpi container all is good and user-added data will be stored - somewhere in the overlays of the ncdata volume. But the “-v ncdata:/data” is only holding the initial files, not the user added files. And if a user wants to use an external drive holding the data, like @cainbantam and I, it will fail.

But thanks for checking and support.

1 Like

so ncdata can be anywhere you want and will be under /var/lib/docker/volumes/ if not specified.

what do your docker logs have to say?

I have exactly the same issue.
NextCloudPi system info says

datadir /data-ro/nextcloud/data

and this directory is outside /data in the -v directive, in the /var/lib/docker/overlay2/<container_id>/merged/data-ro/nextcloud/data

there NextCloudPi puts new users directories and their data.

On the system info page I have read this:
‣ You should use nc-datadir to move your files to your plugged in USB drive
but nc-datadir command is not available in the WebUI and not in the TUI (from the console of the container)

So I think this is a big problem and this docker image is totally unusable with a -v directive on an external disk at the moment.

So check your logs, and share them if need help.

Also maybe you are pulling an old image, the latest is multi arch

@OliverV First of all, thank you very much for taking your time on this “issue”.

I just wanted to let you know, that the version I’m using is the one you are suggesting:

    "RepoDigests": [
        "ownyourbits/nextcloudpi-armhf@sha256:**b283d54325f78667870692fcc5a526075fa6894acd6d65054285d41fab4588e9**"

which I extracted from the pulled docker image.

So I did one more test to compare behaviour between docker image tag 1.24.0 and the most recent release suggested by you, @OliverV: multi arch

To get something “reproducable” and kind of minimal I did the following from a bash console on my raspberry pi:

bash> NCPNAME=test_ncp_issue && sudo docker stop $NCPNAME; sudo docker container rm $NCPNAME; sudo rm -rf /home/pi/test_ncp_issue/$NCPNAME/ /home/pi/test_ncp_issue/$NCPNAME-ro; sudo docker run -d -p 4443:4443 -p 443:443 -p 80:80 -v /home/pi/test_ncp_issue/$NCPNAME:/data --name $NCPNAME ownyourbits/nextcloudpi-armhf:v1.24.0 192.1.1.9

Keeping everything else fixed, and only changing between v1.24.0 and latest tag I get the issue described in my initial post only for the latest tag, but nor for the v1.24.0 tag.

Maybe I did something else wrong, but to me it looks like an issue on the latest tag. If not an issue, then at least a changed behaviour.

Any help would be appreciated.

1 Like

Thank you all guys for your contribution to identify the issue and find a solution. It is really thrilling to read you.
As a modest contribution, I may mention that an apparently working (though not definitive I guess) workaround to me has been to move /var/lib/docker to my external drive and put a symbolic link instead (I tried first to do that with the data-ro folder but it crashed the nextcloud server… maybe I did a mistake…)
Looking forward to find out what happens. Maybe we should rather use v.124 as suggested by the posts of @mdr and @ste_cat

I can confirm what @mdr said. I have tryied ownyourbits/nextcloudpi-arm64:v1.24.0 and it’s working well, nextcloud’s users are correctly located under /data following the -v directive.

I have been able to update nextcloud to 20.0.4 version and NextCloudPi WebUI to 1.15 and everything seems to work well.

The WebUI shows this info:

datadir /data/nextcloud/data

and not

datadir /data-ro/nextcloud/data

It seems correct…

Just wanted to chime in that I also face the same issue on the latest version, if using an empty volume/dir.

However, if I create a /data directory using v1.24.0, and then update the docker container back to the latest version (by removing it and starting a new container) while re-using the /data directory, then my datadir remains as datadir /data/nextcloud/data.