Created
November 21, 2023 11:23
-
-
Save oskaremil/9c817b001d81b6a2ccaf263fcf7f45ef to your computer and use it in GitHub Desktop.
Docker MSSQL
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
#!/bin/bash | |
docker exec sql-server /opt/mssql-tools/bin/sqlcmd -U sa -P *** -Q "CREATE DATABASE TestDatabase" | |
docker exec sql-server /opt/mssql-tools/bin/sqlcmd -U sa -P *** -Q "CREATE LOGIN testuser WITH PASSWORD = '***'" | |
docker exec sql-server /opt/mssql-tools/bin/sqlcmd -U sa -P *** -d TestDatabase -Q "CREATE USER testuser FOR LOGIN testuser" | |
docker exec sql-server /opt/mssql-tools/bin/sqlcmd -U sa -P *** -d TestDatabase -Q "ALTER ROLE db_owner ADD MEMBER testuser" |
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
#!/bin/bash | |
docker volume create sql-server-system | |
docker volume create sql-server-user |
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
#!/bin/bash | |
docker run \ | |
--volume sql-server-system:/var/opt/mssql \ | |
--volume sql-server-user:/var/opt/sqlserver \ | |
-e "ACCEPT_EULA=Y" -e "SA_PASSWORD=***" \ | |
-e "MSSQL_RPC_PORT=135" -e "MSSQL_DTC_TCP_PORT=51000" \ | |
-p 1433:1433 -p 135:135 -p 51000:51000 \ | |
--name sql-server \ | |
--detach --rm mcr.microsoft.com/mssql/server:2022-latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment