Last active
May 21, 2024 01:18
-
-
Save danielmackay/4648d7803e0da06f9c2cd01db9530277 to your computer and use it in GitHub Desktop.
Docker Compose - SQL Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// NOTE: If any of your connection strings real passwords, you should delete them and put them in the user secrets file instead. | |
"ConnectionStrings": { | |
"DefaultConnection": "Server=localhost,1500;Initial Catalog=CleanArchitecture;Persist Security Info=False;User ID=sa;Password=yourStrong(!)Password;MultipleActiveResultSets=True;TrustServerCertificate=True;Connection Timeout=30;" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 --name azuresqledge -d mcr.microsoft.com/azure-sql-edge | |
# docker compose up -d | |
services: | |
db: | |
environment: | |
ACCEPT_EULA: "Y" | |
SA_PASSWORD: "yourStrong(!)Password" | |
# mssql server image isn't available for arm64 architecture, so we use azure-sql instead | |
image: mcr.microsoft.com/azure-sql-edge:latest | |
# If you really want to use MS SQL Server, uncomment the following line | |
#image: mcr.microsoft.com/mssql/server | |
ports: | |
- 1500:1433 | |
restart: always | |
healthcheck: | |
test: ["CMD-SHELL", "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P yourStrong(!)Password -Q 'SELECT 1' || exit 1"] | |
interval: 10s | |
retries: 10 | |
start_period: 10s | |
timeout: 3s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note - Ensure that the host port (default of 1500) is updated in both the YML and JSON file