Using Docker to create a local development environment for Azure SQL Database

Dennis Daume
Jun 21, 2018 · 1 min read

At Mimo, we’re hosting all of our production data in Azure SQL Database. It’s pretty useful to use a copy of that production data for local development, to match the local environment as closely as possible to the production environment.

Since most of our developers work on a Macbook, it’s not possible to just install a local instance of SQL Server and run the development database on that. For that reason, we host a SQL Server instance inside a Docker image of SQL Server on Linux, create a snapshot of the production database and restore that into a new Docker image.

Restoring the database snapshot into a Docker image allows us to easily share the image between all developers and also enables a painless restore flow if you want to reset your local development database.

Here is a Gist of the Dockerfile that we’re using:

Since SqlPackage, which is used to restore .bacpac files (the backup file format that Azure Sql Database uses) is not installed, we’re using a preview version posted in this Github thread. After that the relevant .bacpac file is copied into the image, SQL Server is started and the import process started.

With a bit of hacking around with Azure automation, this file can be used to automatically create a new Docker image every day from a snapshot of the production database so developers always get the latest data every day.

Making Mimo

Mimo makes learning to code easy on mobile and the web.

Dennis Daume

Written by

Co-founder & CTO @getmimo

Making Mimo

Mimo makes learning to code easy on mobile and the web. Take a peek inside the minds of the engineers, designers, and teachers making it happen. https://getmimo.com/

Dennis Daume

Written by

Co-founder & CTO @getmimo

Making Mimo

Mimo makes learning to code easy on mobile and the web. Take a peek inside the minds of the engineers, designers, and teachers making it happen. https://getmimo.com/

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store