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_databaseYouâll need to enter the MySQL password when prompted. Just make sure to replace:
source_databasewith your old databasedestination_databasewith 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-benchStep 3: Run the migration
bench --site site_name migrateReplace 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
mysqldumpand 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
Enjoyed this article?
Check out more blogs on our blog.



