description: run sql server through docker
start
- open and start docker service
- open Powershell
download sql server image
put following commend in powerhell1
docker pull microsoft/mssql-server-linux:2017-latest
start sql server
Asdfgh123
is default password1
2
3docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Asdfgh123" `
-p 1433:1433 --name sql1 `
-d microsoft/mssql-server-linux:2017-latest
if get following error:1
2C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: Conflict. The container name "/sql1" is already in use by container "1da5029c71ab937a25acdb4fadf44f4065c2fea4f6a4f157c1a07516558757bb". You have to remove (or rename) that container to be able to reuse that name.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.
restart the server1
docker start sql1
connect to server
1 | docker exec -it sql1 "bash" |
start sqlcmd tool
1 | /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'Asdfgh123' |
test create database
1 | CREATE DATABASE TestDB |
test acquire database
1 | USE TestDB |
connect from external tools
outside the container1
sqlcmd -S 10.3.2.4,1433 -U SA -P "Asdfgh123"
Stop and remove container
1 | docker stop sql1 |
run sql server with external folder
1 | docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Asdfgh123" ` |
more on search4fan.github.io