Skip to content

Instantly share code, notes, and snippets.

@rchardptrsn
Last active February 13, 2025 06:25
Show Gist options
  • Save rchardptrsn/508f954445829433e840c93167c042ef to your computer and use it in GitHub Desktop.
Save rchardptrsn/508f954445829433e840c93167c042ef to your computer and use it in GitHub Desktop.
Docker compose file for SQL Server 2022
services:
mssql:
container_name: mssql-db
hostname: mssql-db
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
ACCEPT_EULA: 'Y'
MSSQL_SA_PASSWORD: 'Passw0rd'
MSSQL_DATA_DIR: /var/opt/mssql/data
MSSQL_PID: 'Developer'
MSSQL_TCP_PORT: 1433
ports:
- "1433:1433"
volumes:
- ./data:/var/opt/mssql/data
- ./log:/var/opt/mssql/log
- ./secrets:/var/opt/mssql/secrets
@sanu04
Copy link

sanu04 commented Dec 31, 2024

It gave an error, as I logged in as a different user.

SQL Server 2022 will run as non-root by default
Setup step is copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf'

by adding the user as root, it works.
user: root

@Gokul6694
Copy link

2025-02-13 06:24:59.13 spid17s Database 'model' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment