How Can I Backup and Restore Docker Containers Effectively?

April 18, 2025 3 answers
Asked by _tram_driver
I'm diving deeper into Docker inside Unraid and I've been facing some challenges with backup and restoration, especially when it comes to the Immich container. Here's what happened recently: one of my disks failed, and while I had my photos backed up, all the app data for my Docker containers got wiped out, including the database for Immich. When I restarted the container, it was as if I had set it up fresh, losing all users and previous images. I'm hoping to understand how I can ensure that containers like Immich come back to life with all their data intact after a disk swap. Also, I'm planning to transition to Ubuntu and use Portainer. If a disk crashes but I have all the data backed up, how do I restore it properly so everything spins back up just like before? Any advice on achieving this, particularly with practical steps, would be super helpful!

Answers

!show your work
If you want to explore outside of the Unraid confines, consider using native Docker Compose instead of Portainer. Unraid isnโ€™t too restrictive, to be honest. About your issue, it really depends on the specific image youโ€™re working with. If the Immich container behaves like it starts afresh every time, it sounds like you might be missing the right persistence setup for its database, possibly an internal SQLite that should be connected externally.
Reply to this answer
Mirthy
It really hinges on whether you're using bind mounts or Docker volumes. If youโ€™ve got bind mounts set up, you should just be able to restore your app data to the folders that you defined earlier. However, if youโ€™re relying on Docker volumes, youโ€™ll need to restore your Docker volumes from the `/var/lib/docker/volumes` directory since thatโ€™s where all the persistent data lives.
Reply to this answer
PASTRY__BRUSH
Thanks for the insights! So I guess if I make a comprehensive backup of all my volumes, even if itโ€™s a manual save, I can just pop everything back where the container looks for it? Iโ€™m definitely going to try breaking it on a test machine first to see how well this fix works!
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions