How to setup MSSQL Server in 5 minutes (Ubuntu)

Open Terminal in Ubuntu

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo mkdir /opt/mssql/data
sudo mkdir /opt/mssql/data
sudo mkdir /opt/mssql/data

Pull docker and install 

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo docker pull microsoft/mssql-server-linux:2017-latest
sudo docker pull microsoft/mssql-server-linux:2017-latest
sudo docker pull microsoft/mssql-server-linux:2017-latest

Start MSSQL docker with your custom configuration like

-e’MSSQL_SA_PASSWORD=sa@123sa’ -> Setting server admin password.

-p 1433:1433 -> Docker and System port mapping.

-v /var/opt/mssql:/var/opt/mssql -> Mounting System directory as volume to save database files.

–name mssql-2017 -> Name of docker instance

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo docker run -e'ACCEPT_EULA=Y' -e'MSSQL_SA_PASSWORD=sa@123sa' -p 1433:1433 -v /var/opt/mssql:/var/opt/mssql --name mssql-2017 -d microsoft/mssql-server-linux:2017-latest
sudo docker run -e'ACCEPT_EULA=Y' -e'MSSQL_SA_PASSWORD=sa@123sa' -p 1433:1433 -v /var/opt/mssql:/var/opt/mssql --name mssql-2017 -d microsoft/mssql-server-linux:2017-latest
sudo docker run -e'ACCEPT_EULA=Y' -e'MSSQL_SA_PASSWORD=sa@123sa' -p 1433:1433 -v /var/opt/mssql:/var/opt/mssql --name mssql-2017 -d microsoft/mssql-server-linux:2017-latest

Managing MSSQL docker container.

Starting docker

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo docker start mssql-2017
sudo docker start mssql-2017
sudo docker start mssql-2017

Stoping docker

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
sudo docker stop mssql-2017
sudo docker stop mssql-2017
sudo docker stop mssql-2017

you're currently offline