Install and Run SQL Server Docker Container on Mac Like most people, I use Mac, Windows as well Linux OS for development and testing purposes. Primarily I use Mac for Development purpose. I have few projects which uses SQL Server as Data Storage Layer. Setting up Docker Container on Mac and Opening up the ports was pretty easy and doesn’t take more than 10 Minutes. Steps followed:.
Install Docker. Pull SQL Server Docker Image. Run SQL Server Docker Image. Install mssql Client. Install Kitematic. Open the Ports to connect to SQL Server from the network.
This article explains how to install the Microsoft ODBC Driver for SQL Server on Linux and macOS, as well as the optional Command-Line Tools for SQL Server (bcp and sqlcmd) and the unixODBC Development Headers.
Setup port forwarding to enable access outside the network Install Docker: Get Docker dmg image and install. Just follow the prompts and its very straight forward. Once you have installed docker, you can verify the installation and version. Docker run - d - name macsqlserver - e 'ACCEPTEULA=Y' - e 'SAPASSWORD=Passw1rd' - e 'MSSQLPID=Developer' - p 1433: 1433 microsoft / mssql - server - linux: 2017 - latest -d: this launches the container in daemon mode, so it runs in the background –name nameyourcontainer (macsqlserver): give your Docker container a friendly name, which is useful for stopping and starting containers from the Terminal.e ‘ACCEPTEULA=Y: this sets an environment variable in the container named ACCEPTEULAto the value Y. This is required to run SQL Server for Linux.e ‘SAPASSWORD=Passw1rd’: this sets an environment variable for the sa database password.
Set this to your own strong password. Also required.e ‘MSSQLPID=Developer’: this sets an environment variable to instruct SQL Server to run as the Developer Edition.p 1433:1433: this maps the local port 1433 to the container’s port 1433.
SQL Server, by default, listens for connections on TCP port 1433. Microsoft/mssql-server-linux: this final parameter tells Docker which image to use Install SQL Client for MAC If you don’t have npm installed in Mac, install homebrew and node. Telnet 69.11.122.159 1433 Unless you absolutely require it, its very bad idea to expose the SQL Server to internet. It should be behind the network, only your webserver should be accessible via internet. Troubleshooting: While launching docker container, if you get the error saying that it doesn’t have enough memory to launch SQL Server Container, go ahead and modify the memory allocation for docker container. This image requires Docker Engine 1.8+ in any of. At least 3.25 GB of RAM.
Make sure to assign enough memory to the Docker VM if you’re running on Docker for. I have setup this way. $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9ea3a24563f9 microsoft/mssql-server-linux:2017-latest '/bin/sh -c /opt/m.' About an hour ago Up About an hour 0.0.0.0:1433-1433/tcp macsqlserver $ docker logs macsqlserver 2017-10-08 23:06:52.29 Server Setup step is copying system data file 'C: templatedata master.mdf' to '/var/opt/mssql/data/master.mdf'.
2017-10-08 23:06:52.36 Server Setup step is copying system data file 'C: templatedata mastlog.ldf' to '/var/opt/mssql/data/mastlog.ldf'. 2017-10-08 23:06:52.36 Server Setup step is copying system data file 'C: templatedata model.mdf' to '/var/opt/mssql/data/model.mdf'. 2017-10-08 23:06:52.38 Server Setup step is copying system data file 'C: templatedata modellog.ldf' to '/var/opt/mssql/data/modellog.ldf'.
Connect to SQL Server Enter the SQL Server connection details. Here are the details I used on the:.
Server Name: localhost. Authentication Type: SQL Login. User name: sa. Password: myPassw0rd. Database Name:.
Server Group: You've now connected to SQL Server with SQL Operations Studio. Once logged in, the Server Dashboard is displayed: Connection Error? If you're trying to connect to SQL Server on your Mac, make sure your Mac has Docker running and you've started the SQL Server Docker container. Here's how:. Open Docker just as you would open any other application (via the Launchpad, Applications folder, etc). Once Docker is running, open your Terminal and start the Docker container. It should look something like this.