Docker Survival Guide: Downgrading and Fixing Persistence
If you've been self-hosting for a while, you know the drill: you see an update, you click pull, and suddenly—everything breaks. Recently, a bug in the latest version of File Browser caused some headaches, requiring a strategic downgrade to a stable version. But there was a catch—my database wasn't persistent!
In this post, I’ll show you how to downgrade safely and, more importantly, how to rebase your directory so your settings never vanish again.
The Scenario: Buggy Updates
Sometimes, "latest" isn't "greatest." Due to recent compilation bugs in the current File Browser release, the community recommendation is to pin your version to v2.35.0. If you just change the tag and restart, you might realize your users and settings have disappeared. This happens because the database was living inside the container's temporary filesystem.
Step 1: The "Self-Contained" Directory Strategy
Instead of letting Docker decide where to put your data, we are rebasing everything into a single, portable folder: ~/filebrowser. This folder will hold your docker-compose.yml and your filebrowser.db.
# Create and enter your app directory mkdir -p ~/filebrowser cd ~/filebrowser
Create the persistent database file on the host
touch filebrowser.db chmod 664 filebrowser.db
Step 2: The Optimized Docker-Compose
By using relative paths (./), we tell Docker to look for the database in the same folder as the compose file. We also "lock" the image version to avoid future buggy updates.
version: '3' services: filebrowser: image: filebrowser/filebrowser:v2.35.0 container_name: filebrowser ports: - "8080:80" volumes: - /path/to/your/actual/files:/srv # The Magic Line: Mapping the DB to the host - ./filebrowser.db:/database/filebrowser.db restart: unless-stopped
Step 3: Deploy and Verify
Run the following to recreate the container with the stable version and persistent mapping:
docker compose up -d --force-recreate
Now, even if you delete the container or downgrade again, your filebrowser.db stays safe on your Debian host.
Bonus: The "Instant Backup" Command
Since everything is now in ~/filebrowser, you can backup your entire configuration (users, settings, and database) with one command:
tar -czvf ~/fb_backup_$(date +%F).tar.gz ~/filebrowser
Conclusion
Docker volumes can be tricky. By rebasing your apps into self-contained directories and using specific version tags instead of :latest, you gain full control over your home server. Happy (stable) hosting!
Support My Work
If this blog post helped you, please consider a small donation. Your support helps keep this content free and accessible for everyone. Thank you!
Donate with PayPal
The easiest way to support me is by buying me a coffee through PayPal. It's quick, secure, and uses a trusted platform.
Buy Me a Coffee! or a new Macbook!Donate with Crypto
You can also support me with cryptocurrency. Just copy the address of your preferred coin below.

Comments
Post a Comment