Backup docker installation to be restored after shutdown

I’m trying to find a way to backup a docker container of NC, so that even if my RPI shuts down, I can fire it right up and it’ll have all the users and files already saved and I don’t need to go through installation again.

I’ve searched a lot, but the best thing I found was using docker save/load, which seems fine, but it’s not perfect:

It saves the entire container with everything in it, so it also means duplicating all my files.
If I have 100GB of free space, I can only actually use 50GB of them, and have the other 50 for the backup (if I’m okay with having just one backup).

I’m trying to see if there’s a way to install docker, but make it use the host file system, so even if the RPI shuts down or the container stops, the data like uploaded files or the config files will remain and I’ll be able to use them next time starting the docker.

Is this possible?

Do you know of any other backup methods that I can use to quickly fire up NC docker after shutdown with all things saved?

thanks!

Technical details:

Raspberry Pi: 4 model B, 2gb RAM, and a 64gb sd card
Nextcloud version: Nextcloud 28.0.0
Operating system and version: Linux MACHINE 6.1.0-rpi7-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux
Apache version: Apache/2.4.57 (Debian)
PHP version: PHP 8.2.13 (cli)

I’m not really sure I understand your issue right as you didn’t provide enough technical details.

I understand you hit issues loosing container data when the host restarts. The correct Docker term to keep persistent data is called ‘volume mounts’ or ‘bind mounts’. For Nextcloud Docker image you can consult the docs Docker persistent data to see which data you want keep on the host when you destroy a container…

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.