Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to run Microsoft SQL Server 2017 using Docker

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use Docker to run Microsoft SQL Server 2017, the article is very detailed, has a certain reference value, interested friends must read it!

Start the Microsoft SQL Server 2017 container

The following is the docker-compose.yml file used to build 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 container_ 27017" rabbit: image: rabbitmq:3-management ports:-"5672"-"4369"-"5671"-"25672"-"15672" container_ Name: rabbitmq hostname: my-rabbitmq volumes:-${RABBITMQ_DATA_VOLUME} postgres: image: postgres ports:-"5432 mssql 5432" container_name: postgres volumes:-${POSTGRESQL_DATA_VOLUME} mssql: image: microsoft/mssql-server-linux:2017-latest ports:-"1433 image 1433" container_name: mssql environment:-ACCEPT_EULA=Y-SA_PASSWORD=G1veMeP@ss

This docker-compose file contains the definitions of four services, and today we will only focus on the last one, which is mssql. You can see:

The Docker image name of 1.Microsoft SQL Server is: microsoft/mssql-server-linux,tag is 2017-latest

2.SQL Server listens in the container for port 1433, the standard SQL Server port

3. Two environment variables are required to start the SQL Server container: ACCEPT_EULA=Y, which means to accept the end user license agreement, and SA_PASSWORD=G1veMeP@ss, which means to set the password of the sa user. This user password must conform to the strong password specification (numbers, letters, case, at least 8 characters), and then when the client connects, you need to use this password to log in to the server.

Of course, you can use docker run instead of docker-compose, then the method is similar, for example, you can use the following statement:

Sudo docker run-e 'ACCEPT_EULA=Y'-e' SA_PASSWORD=G1veMeP@ss'\-p 1433 SA_PASSWORD=G1veMeP@ss' 1433-- name mssql\-d microsoft/mssql-server-linux:2017-latest

You can also start the SQL Server container. When running SQL Server in Docker, it is important to note:

1. The memory of the host (host machine) needs at least about 3.5GB.

SQL Server in 2.Docker is a developer version (Developer Edition) with the same functionality as the enterprise version, but can only be used in development or test environments, not in production environments

Connect SQL Server 2017

The official documentation describes the use of the docker exec command to execute the sqlcmd command to connect and use the database in a running SQL Server 2017 container. Of course, you can also use a graphical client, such as SQL Server Management Studio or Visual Studio's Server Explorer, to connect to SQL Server 2017 running in Docker in the same way as a regular version of SQL Server. For example, here is the effect of connecting Microsoft SQL Server on Linux for Docker in the Server Explorer of Visual Studio:

The above is all the contents of the article "how to run Microsoft SQL Server 2017 with Docker". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report