When I reset my development machine a while back, I made the decision to forego installing Microsoft SQL as I usually do, and just use the Docker image instead.

The cool thing is that the image has SQL running on a linux image, and for a while, everything was good. I ran into a slight issue when trying to restore a backup though - I didn't have a way to restore the database from SSMS, since the file system was inside the container.

When I created the container, I didn't mount a directory to it, and I didn't want to re-create the image as that would also mean my databases would be wiped. Luckily I found a way to add a mount and still keep everything from before!

  1. First, you have to find the ID of the container that you're wanting to add a mount to and commit the the changes to the container as a new image
// Find the id of the container
docker ps -a

// Make a commit to save it

2. Next, you run the new image and make sure to include the desired mount location


3. Now that we have a new container with the previous data, we're free to delete the "bad" container and rename the new one if needed.