I am a casual coder, just for fun, and I got owncloud running on my Raspberry Pi 4 (arm64) using docker. The problem is understanding how to get the container to be persistent and write the files to me specified directory.
In the yml file I changed the data directory but I can’t see files loaded into that file.
volumes:
- files:/mnt/data (I change this to an external disk)
All files stored in this setup are contained in Docker volumes, rather than a physical filesystem tree. It is the admin’s responsibility to persist the files. Use, e.g., docker volume ls | grep ownclouddockerserver to inspect the volumes. Use e.g., docker run -v ownclouddockerserver_files:/mnt ubuntu tar cf - -C /mnt . > files.tar to export the files as a tar archive.
I have no idea what this means.It’s asking me to make a tar when all I need is to write files to my chosen disk. Can someone simplify this for me?
This is a bit misleading. In Docker we speak of persistent data if it survives the lifecycle of the containers, this means that you can stop and re-create containers and your data is still here. This achieved by creating the volumes files, mysql and so on.
Data on the filesystem is not per se more persistent than data in a Docker volume. If you want to create a backup then you can export the volume as it is described into a tar archive, but you have to store it somewhere outside of the Raspi to get any additional security. This file just contains a part of your installation. You should read Backing up ownCloud to see how you can backup the complete system.
I see what you mean. Thank you for the explanation.
Then if I reformulate my question. How can I store the data from the container to an external USB? This is because the max size of the sdcard is 16gb but the external USB is 2tb.
In the yml I specified the data volume but no data gets written there.
Edit. Unless I run the container from the external drive?
Take a look at the docs for volumes in compose files. Under ‘short syntax’ you see how to mount absolute paths:
# Specify an absolute path mapping
- /opt/data:/var/lib/mysql
I recommend that you store all the volumes on the hard disk. If you have a lot of write-intensive operations on the database the SD card dies before you had time to read about backups.