Skip to content

Instantly share code, notes, and snippets.

@rizky
Last active March 7, 2017 17:08
Show Gist options
  • Save rizky/e05eef61d2c5519ecb4989e8f3bdaa3b to your computer and use it in GitHub Desktop.
Save rizky/e05eef61d2c5519ecb4989e8f3bdaa3b to your computer and use it in GitHub Desktop.
Setup MSSQL and Initiate Database
#create new docker-machine make sure docker-machine have 3.5GB of ram
#docker-machine create -d virtualbox --virtualbox-memory 4096 default
#edit default docker-machine make sure docker-machine have 3.5GB of ram
docker-machine stop
VBoxManage modifyvm default --memory 4096
docker-machine start
# switch to docker-machine
eval "$(docker-machine env default)"
# run docker image rizkyario/mssql-server-linux
# microsoft/mssql-server-linux with mssql-tools installed
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Superstr*ng-p4ssword' -p 1433:1433 --name mssql -d rizkyario/mssql-server-linux
# initiate database
cat init-db.sql | docker exec -i mssql sqlcmd -S localhost \
-U sa -P Superstr*ng-p4ssword -t 30
# set connection string. Make sure TrustServerCertificate=True
# Server={{docker-machine-ip-address}},1433;Initial Catalog={{database-name}};Persist Security Info=False;User ID=sa;Password={{superstrong-password}};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment