Setup SQL Server instance on Linux on Docker
This blog post talks about the setup of a SQL server instance on a Linux machine running on Docker. The versions of the softwares used are mentioned below:
Docker: Community Edition Version 17.06.1-ce-mac24 (18950)
OS of machine running Docker: MacOS Sierra 10.12.6
(d) Get the container ID of the SQL server (similar to the SQL server instance name):
(e) Sample queries to get list of databases and existing connections on the SQL server instance:
Docker: Community Edition Version 17.06.1-ce-mac24 (18950)
OS of machine running Docker: MacOS Sierra 10.12.6
SQL server: Microsoft SQL Server 2017 (RC2) - 14.0.900.75 (X64)
Developer Edition (64-bit) on Linux (Ubuntu 16.04.2 LTS)
Developer Edition (64-bit) on Linux (Ubuntu 16.04.2 LTS)
DBeaver: Community Edition 4.2.5
Steps taken for this setup were as follows:
(1) Pull and run the container image. Pull the SQL Server 2017 Linux container image from Docker Hub.
(1) Pull and run the container image. Pull the SQL Server 2017 Linux container image from Docker Hub.
(a) Launch Terminal application and type the below command:
sudo docker pull microsoft/mssql-server-linux:2017-latest(b) To run the container image with Docker, you can use the following command from a bash shell (Linux/macOS):
192-168-1-8:~ ashwi$ docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=xxxxxx' -e 'MSSQL_PID=Developer' --cap-add SYS_PTRACE -ti -p 1401:1433 microsoft/mssql-server-linux
(c) View the docker processes to confirm that the SQL server instance is running:
sudo docker pull microsoft/mssql-server-linux:2017-latest(b) To run the container image with Docker, you can use the following command from a bash shell (Linux/macOS):
192-168-1-8:~ ashwi$ docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=xxxxxx' -e 'MSSQL_PID=Developer' --cap-add SYS_PTRACE -ti -p 1401:1433 microsoft/mssql-server-linux
(c) View the docker processes to confirm that the SQL server instance is running:
(d) Get the container ID of the SQL server (similar to the SQL server instance name):

(e) Sample queries to get list of databases and existing connections on the SQL server instance:
All of the above queries were executed on Terminal application on MacOS.
However, as many of the users/administrators on SQL server are used to work on GUI. Hence, I decided to use DBeaver tool to connect to the SQL server instance.
Once the tool is installed on MacOs, we need to create a New Connection using the configuration and information similar to below:
I have created a test database "testdb", same properties can be used for any database (master or anyone you want)
However, as many of the users/administrators on SQL server are used to work on GUI. Hence, I decided to use DBeaver tool to connect to the SQL server instance.
Once the tool is installed on MacOs, we need to create a New Connection using the configuration and information similar to below:
I have created a test database "testdb", same properties can be used for any database (master or anyone you want)

All the DDL (CREATE/DROP/ALTER etc. ) and DML(SELECT/INSERT/UPDATE/DELETE) statements can be executed using the DBeaver tool, just like the Native SSMS.
Reference links:
https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker
https://dbeaver.jkiss.org/download/
https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker
https://dbeaver.jkiss.org/download/
Comments
Post a Comment