How to Use Microsoft Sql Server on Docker Compose
Table of Contents
Related to:: Sql Server - Docker
Official image: Microsoft SQL Server - Ubuntu based images
Editions and Remarks
The MSSQL_PID
variable controls which edition we’ll use:
The free options are Developer
(the default option) and Express
.
- Express has a 10 GB limit
- If used as a developer, it doesn’t have a limit, but it is not recommended for use in production.
Check more info about this in Editions of SQL Server
Docker Compose
docker-compose.yml
version: '3.6'
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
user: root
volumes:
- data:/var/opt/mssql/data
- log:/var/opt/mssql/log
- secrets:/var/opt/mssql/secrets
- backup:/var/opt/mssql/backup
networks:
- sqlserver_network
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=myStrongPass
- TZ=America/Sao_Paulo
- MSSQL_PID=Express
ports:
- 11433:1433
restart: unless-stopped
volumes:
data:
log:
secrets:
backup:
networks:
sqlserver_network:
driver: overlay