MS SQL Server: Use Docker Compose for Microsoft SQL Server
When I started my IT career over 20 years ago, Microsoft was a company which supported their software only on their own platforms. They hated Open Source, and they stated that Linux and Open Source would be only for hobbyists.
Fortunately, they changed their mind over the years - my favourite editor VS Code is available for all relevant platforms, they support Linux in Azure Cloud, and they distribute SQL Server also for Linux - and for Docker.
But why should I run SQL Server on Linux and/or Docker, and not on Windows, where integration with other Microsoft services is available?
- Roles
Maybe I'm a DBA who want's to test something with SQL Server, but I'm not an IT member. I'd need a server (never mind if native or virtual) running Windows. But I don't want to use a running server, because I don't want to disturb someone else. And installing a new server using Windows would mean it has to be licensed...
- Time
Creating an SQL Server within Docker just needs a few minutes.
- Housekeeping
After my tests are finished, I'd just delete my SQL Server container. On Windows, I would have to uninstall...
For sure, there are disadvantages for SQL Server on Docker or Linux:
- Integration with AD does not come out of the box
- Not all features available
- No Windows Server Failover Cluster
So creating a Docker container is quite simple:
services:
mssql:
container_name: sql-server
image: mcr.microsoft.com/mssql/server:2022-latest
restart: always
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: "XxXxXxXx"
ports:
- 1433:1433
volumes:
- ./mssql:/var/opt/mssql
ACCEPT_EULA
means that you accept the Microsoft licenseSA_PASSWORD
is the password for the administratormcr.microsoft.com/mssql/server
is the root for the software image- Versions that are available:
- 2017
- 2019
- 2022
You can use latest
to use the latest patch, but you can use also a specific CU, like 2022-CU13-ubuntu-22.04
or 2017-CU14-ubuntu
.
Please keep in mind: you will need at least 2 GB of memory for your container. Additionally, only platform x86_64
is available. No ARM64
for now...
If you need more information, see here: [Microsoft SQL Server for Docker](https://hub.docker.com/r/microsoft/mssql-server)