ReverseBits
Back to Blogs
Python2025-04-28

Frappe LMS Data Recovery: Prevent Costly Downtime After Docker Failures

D
Dipali ShimpiAuthor
55 reads

TL;DR

If Docker wipes your Frappe LMS data, you CAN recover it. The database files persist in Docker volumes even after container deletion. Use `docker volume ls` to find your volume, mount it to a new container, and export using `bench backup`. Prevention: Set up automated daily backups to external storage—this 10-minute setup prevents weeks of data loss.

If you’re running your Frappe LMS inside Docker like I am, chances are you might eventually run into a scary moment: you stop your Docker containers, bring them back up… and bam — your data is gone.

That’s exactly what happened to me. And let me tell you, it was a heart-drop moment. But the good news? I got all my LMS data back — and in this post, I’ll walk you through exactly how I did it, step by step.

🧠 What Went Wrong

I had everything running smoothly inside Docker. But I didn’t use named volumes or persistent storage for my MariaDB container (rookie mistake 😅). So when I brought the containers down, the data went down with them.

When I ran docker-compose up again, it spun up fresh containers and created a brand-new blank database — just like a clean install. My LMS opened fine, but all the user data, courses, and progress were gone.

🔍 Finding the Lost Data

I wasn’t ready to give up. I jumped into the MariaDB container and ran:

SHOW DATABASES;

To my surprise, I saw a list of old databases still hanging around. It seems Docker hadn’t completely nuked everything — maybe the volumes were still lingering, or maybe it was using a previous container state.

Either way, I spotted a database that matched the naming pattern and looked like it had my old LMS data. I got lucky.

🛠️ Copying Old Data Into the New Database

To move the data from the old database into the new one, I used mysqldump — but here’s the trick: you need to do this inside the MariaDB container.

Step 1: Enter the MariaDB container

docker exec -it <mariadb_container_name>

Step 2: Dump and import in one go

mysqldump -u source_user -p source_database | mysql -u destination_user -p destination_database

You’ll need to enter the MySQL password when prompted. Just make sure to replace:

  • source_database with your old database
  • destination_database with the fresh one Docker created
  • the usernames with the correct ones for each database

This command dumps everything from the old DB and pipes it directly into the new one.

🧹 Migrating the Frappe Site

Now that the data was restored, I needed to make sure it played nicely with the current Frappe setup. That’s where the migrate command comes in.

Again, this has to be done inside the Frappe container.

Step 1: Enter the Frappe container

docker exec -it <frappe_container_name>

Step 2: Go to the bench directory

cd frappe-bench

Step 3: Run the migration

bench --site site_name migrate

Replace site_name with your actual Frappe site name.

This step applies all pending patches and syncs the database schema with the latest code. Without it, things could break or behave strangely.

✅ And Just Like That… My Data Was Back!

I opened my LMS in the browser, refreshed the page, and boom — everything was back. All my data, courses, and users — just like before. Huge relief. 😌

💡 Lessons Learned (So You Don’t Make My Mistakes)

Here are a few things I’ll definitely be doing going forward:

  • Use named volumes in Docker to make sure data sticks around between container rebuilds
  • Set up automated backups using mysqldump and a simple cron job
  • Double-check volume mounts and configurations in docker-compose.yml

🙌 Final Thoughts

If you’ve ever lost data from your Frappe LMS Docker setup, don’t panic — chances are, it’s still there waiting to be recovered. I hope this guide helps you get back up and running without losing your sanity.

If you have other tricks, questions, or want help tweaking your setup — drop a comment! I’d love to hear how others are managing LMS backups in Docker too.

Related Topics

PythonFrappeLms SoftwareLearningmanagementsystemPython Programming

Enjoyed this article?

Check out more blogs on our blog.

Read More Blogs