Docker Community Forums

Share and learn in the Docker community.

How to create persistent containers with OwnCloud Docker on R Pi 4?

Hi,

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)

According to this link https://doc.owncloud.com/server/admin_manual/installation/docker/ it says I need to do this:

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.

Thank you for the follow up.

I have already used the short syntax for specifying an absolute path in the compose file. I did this for the Data, Mysql, Redis, and Backup.

I used something like this for each volume.

Volumes:
- /my/mount/point/owncloud/redis

Portainer shows that it creates two volumes instead one and that when I move data across I can’t seem to find it in the external drive.

Thinking of using nextcloud instead

I’ve no idea where you put this command and it’s either imcomplete or wrong. You have to change the volume commands for each service.

services:
  owncloud:
    ...
    volumes:
      - /my/mount/point/owncloud/files:/mnt/data

The same for the databases.

Doesn’t change anything regarding to volumes.

I am following this procedure found here https://doc.owncloud.com/server/admin_manual/installation/docker/

But specifically…

Copy docker-compose.yml from the GitHub repository*

wget https://raw.githubusercontent.com/owncloud/docs/master/modules/admin_manual/examples/installation/docker/docker-compose.yml*

Build and start the container

docker-compose up -

Once I get the YML file I edit the sections where a volume is required using…

$ sudo nano docker-compose.yml

I save the file and then run docker-compose

I have used the short syntax format to replace the default volumes to where I would like it installed.

Is the YML compose file the wrong thing to edit?