SQL Server has traditionally been a pain to run on your local machine. It’s bulky to install and it consumes a fair amount of resources to operate. Luckily, there is now an easier way to run SQL Server on your local machine via Docker images. One somewhat large download and two commands later, you can connect to your local SQL Server through Azure Data Studio, SSMS, or any other application for that matter.
The image provided by Microsoft includes the base installation of SQL Server, with a few optional components left out, and little in terms of tooling. But Docker is an open ecosystem, and other contributors have created images based on Microsoft’s original SQL Server for Linux image. I’ve compiled a list of those extended images that I’ve found useful. Hopefully they can be of use to you too.
Before we go any further, the official SQL Server on Linux image might be all you need. You can run any edition of SQL Server 2017 or 2019 with it, execute T-SQL commands against it with SQLCMD, and copy data with BCP. These tools aren’t part of the path though, so you need to specify the full path to execute them,
The official image doesn’t have supplemental features like Full Text Search, SqlPackage, or debugging tools. Let’s look at some options for those.
Extra Debugging Tools
Need to understand what’s going on inside the container? This image comes packed with all sorts of useful tooling, including curl, rpm, openssl, and net-tools. Whether you need to do some basic debugging or monitoring, it should have you covered.
Full Text Search and SQLPACKAGE
SQL Server has an amazing full-text search feature that builds search engine functionality into your database, but it isn’t included with the base image provided by Microsoft. This image adds Full Text Search to Microsoft’s parent image for you. It also includes SqlPackage, which can be used to import backups (in the bacpac format) to your SQL Server instance.
Seeding A Database On Launch
Most projects require some reference data to be loaded before execute operations against it. This image, based on the SQL Server 2017 image, lets you mount a volume with any number of SQL script files that you’d like to execute when the container starts. Similarly, this image, based on SQL Server 2019, achieves the same thing in a slightly different way. If you’ve got pre-built scripts to seed your database, you can’t go wrong with these base images.
If All Else Fails, Roll Your Own
There are many more SQL Server for Linux images out on Docker Hub. Finding one that fits your exact needs can prove tedious, and it might be more practical to build your own. You can inspire yourself from the Dockerfile of one or more existing images to create a new image that’s exactly what you’re looking for. That’s the beauty of Docker.