Teddycloud on Raspberry Pi/Portainer: How to Backup + Restore

I just did it two days ago. I’m not aware of a backup feature in Portainer so I did it manually.

As already mentioned, you have to backup the used volumes of Teddycloud. Depending on your docker-compose.yaml, it depends where they are stored. If you didn’t use custom bind mounts but the proposed file from Team Revvox, they are most probably in the default path like in my example.

  1. Find all used volumes of Teddycloud
    docker inspect -f '{{range .Mounts}}{{.Type}}: {{.Source}} => {{.Destination}}{{println}}{{ end }}' teddycloud
    Result:
volume: /var/lib/docker/volumes/teddycloud_content/_data => /teddycloud/data/content
volume: /var/lib/docker/volumes/teddycloud_firmware/_data => /teddycloud/data/firmware
volume: /var/lib/docker/volumes/teddycloud_library/_data => /teddycloud/data/library
volume: /var/lib/docker/volumes/4ef****a0d/_data => /teddycloud/data/www/custom_img
volume: /var/lib/docker/volumes/teddycloud_certs/_data => /teddycloud/certs
volume: /var/lib/docker/volumes/teddycloud_config/_data => /teddycloud/config
volume: /var/lib/docker/volumes/teddycloud_cache/_data => /teddycloud/data/cache
  1. Backup these folders
    You can copy them to an external drive, a network mount (NAS), secure-copy them to another machine (what I did) or use rsync to sync them to a target of your choice.
    I copied all volumes starting with teddy* to another Pi/Mac and then the custom_img one manually:
sudo scp -r /var/lib/docker/volumes/teddy* pi@192.168.178.52:/home/pi/teddycloud/backup/
sudo scp -r /var/lib/docker/volumes/4ef****a0d pi@192.168.178.52:/home/pi/teddycloud/backup/

After you setup your new Pi 4 with docker and teddycloud, before starting the stack/container for the first time, copy all these volumes back to the same position where they have been before (/var/lib/docker/volumes/teddycloud*). You need sudo again.

That’s it.

Btw: the best thing you can do tou your Pi is to get rid of the internal sd card (or just use it for backups) and boot everything from an external SSD (via USB3). So the whole OS. It’s a huge performance improvement (I/O) as well as way more robust. External SSDs with 256GB size are really cheap these days. Doesn’t have to be the fastest one as it’s limited by USB3 anyway, but even “slower” SSD are a lot faster than the internal SD. I bought this one for 25€ (Deal).