Use Docker to run Microsoft SQL Server 2017

Source: Internet
Author: User
Tags mssql management studio sql server management sql server management studio server port strong password rabbitmq docker run

The recent effort to write case code WETEXT for the Apworks framework has been in free time every day. In the text publishing and processing microservices, I intend to use Microsoft's SQL Server for Linux to do the demo, so I joined the MS SQL Server service in my docker-compose. In fact, running SQL Server in Docker is very easy, so let's make an introduction today.

Start the Microsoft SQL Server 2017 container

Here is my docker-compose.yml file for infrastructure services in my current Wetext case (this file will change in the future, see GitHub for the latest version):

Version: "3" Services:    MongoDB:        image:mongo        volumes:            -${mongodb_database_volume}        Container_ Name:mongodb        Ports:            -"27017:27017"    Rabbit:        image:rabbitmq:3-management        ports:            -" 5672:5672 "            -" 4369:4369 "            -" 5671:5671 "            -" 25672:25672 "            -" 15672:15672 "        container_name: RABBITMQ        hostname:my-rabbitmq        volumes:            -${rabbitmq_data_volume}    Postgres:        Image: Postgres        Ports:            -"5432:5432"        container_name:postgres        volumes:            -${postgresql_data_ VOLUME}    MSSQL:        image:microsoft/mssql-server-linux:2017-latest        ports:            -"1433:1433"        Container_name:mssql        Environment:            -accept_eula=y            -[email protected]

This docker-compose file contains definitions of four services, and today we are only focusing on the last one, namely MSSQL. can see:

    1. The Docker image for Microsoft SQL Server is named: Microsoft/mssql-server-linux,tag to 2017-latest
    2. SQL Server listens on port 1433 in the container, which is the standard SQL Server port
    3. Starting the SQL Server container requires two environment variables: accept_eula=y, which indicates acceptance of the end User License Agreement, and[email protected], which indicates the password for the SA user is set. This user password to comply with strong password specification (number, letter, case, at least 8 characters), and then when the client connection, you need to use this password to log on to the server

Of course, instead of using docker-compose, you can use Docker run directly, and the method is similar, such as using the following statement:

sudo docker run-e ' accept_eula=y '-e ' [email protected] '-    p 1433:1433--name MSSQL-    D Microsoft/mssql-server-lin Ux:2017-latest

You can also start the SQL Server container. When running SQL Server in Docker, you need to be aware of:

    1. Host machine memory needs to be at least about 3.5GB
    2. The SQL Server in Docker is the developer version (Developer Edition), with the same functionality as the Enterprise Edition, but only for development or test environments and not for production environments
Connecting to SQL Server 2017

Official documentation describes using the Docker EXEC command to perform a sqlcmd command for connection and database use in a SQL Server 2017 container that is already running. Of course, you can also use graphical clients, such as SQL Server Management Studio or Visual Studio's Server Explorer, to connect to SQL Server running in Docker 2017, as is the method for connecting to the normal version of SQL Server. For example, the following is the effect of connecting Microsoft SQL Server on Linux for Docker in Visual Studio's Server Explorer:

Reference documents
    • Run the SQL Server container image with Docker
    • Docker Repository:microsoft/mssql-server-linux

Use Docker to run Microsoft SQL Server 2017

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.