24 Sept 2019

How to run MS SQL Server on macOS using Docker.


Pull the SQL Server 2017 Linux container image from Microsoft Container Registry.

sudo docker pull microsoft/mssql-server-linux


Run the container image with Docker

docker run -d --name mssqllinux -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=YourPassword123' -p 1433:1433 microsoft/mssql-server-linux


To view your Docker active containers (container is an instance of the image)

sudo docker ps -a 


-a // active containers

docker container ls


To view your docker images

docker image ls


Remove image

docker rmi -f <image_id>

-f // force


Remove container (you should stop the container before)

docker stop <id_or_name>
docker rm <id_or_name>



Start container after reboot

docker start <id_or_name>

========================


Test connection with sql-cli

Install sql-cli (Node.js should be installed)

sudo npm install -g sql-cli

Connect

mssql -u sa -p YourPassword123

after connection test with the command

select @@version


Microsoft SQL Server 2017 (RTM-CU13) (KB4466404) - 14.0.3048.4 (X64) 
Nov 30 2018 12:57:58 
Copyright (C) 2017 Microsoft Corporation
Developer Edition (64-bit) on Linux (Ubuntu 16.04.5 LTS)

========================

Connect to Database:

Login: sa
Password: YourPassword123
Server: localhost


No comments:

Post a Comment

Popular Posts