By Steve Endow
(This blog post is inspired by a forum question. Credit to Arvydas for the question and sharing the solution.)
What if I made the mistake of storing some "worthwhile" data in a Business Central Docker container over the course of several months? Perhaps it was test data or data imports that I didn't think I would ever need--but then 3 months later I realized that the accumulated data was valuable.
In theory, no big deal. If you realize that you want to keep the data from a working container, Stefan MaroĊ has a blog post with instructions on converting that Container into an Image using "docker commit". Just create an image and you can make new containers from that image. You could also backup the SQL databases from the Docker Container to the local file system.
But, what if the Business Central Docker Container with your valuable data stops working due to a Windows Update? And you only realize you need that data after the container stops working. If the Container can't be started at all, how can you extract the Business Central data?
This solution appears to allow me to copy the SQL mdf and ldf files from the broken container to my local file system, then copy the mdf and ldf files to a new working container to effectively "restore" them.
This may not work for all situations where a BC container has issues, but should work if the container is intact, but just won't start up due to a Docker or Windows issue or error.
Let me know if there are any issues or caveats with using this method to restore the data from a container.