How Can I Backup and Restore Docker Containers Effectively?
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
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
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
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