===============================================
2019/12 / 8_ first edit ccb_warlock
===============================================
Because of the recent work project using mssql (since know mssql, I almost never talk about another cumbersome name: sql server), I had to relearn to use mssql.
My understanding is that, when using mssql just use the data table, with the development of a container than to install a high efficiency in a win server resources in the province and run by docker.
Of course, if the need to write and debug stored procedures, it is still developing and debugging ssms it (process than oracle, mysql child too much heart).
Because I taught myself over the docker, and he likes to toss this technology can save time, so put together this reference notes to passers-by.
A precondition
- Environment has deployed the Swarm Docker ( http://www.cnblogs.com/straycats/p/8978135.html )
- The best also deployed portainer ( http://www.cnblogs.com/straycats/p/8978201.html )
- The default swarm create a network: swarm-net
Second, deploy MSSQL
Because the project needs, I deployed a mssql 2017.
2.1 Create a directory mapping
mkdir -p /usr/docker-vol/mssql
2.2 Configuration mssql-stack.yml
# Edit mssql-stack.yml
mkdir -p /opt/compose
vi /opt/compose/mssql-stack.yml
# Add the following contents into a mssql-stack.yml file, wq save.
version: "3.6" services: mssql: image: mcr.microsoft.com/mssql/server:2017-latest-ubuntu environment: - TZ = Asia / on Shanghai - ACCEPT_EULA = the Y- # agree to the terms - sa_password = Abc111111 # password sa account Volumes: - / usr / Docker-Vol / MSSQL: / var / opt / MSSQL deploy: replicas: 1 restart_policy: condition: any resources: limits: cpus: " 1 " Memory: 2G # MSSQL to at least 2G memory, not to limit too small update_config: Parallelism: 1 # updated every time a copy of Delay: 5S # each update interval Monitor: 10s # single update is not over how long it is determined that the update fails max_failure_ratio: 0.1 # of updates can tolerate a maximum failure rate order: start -first # update the boot priority order for the new tasks the ports: - 1433: 1433 networks: - swarm-net networks: swarm-net: external: true
2.3 Creating Service
1) command mode
cd /opt/compose
docker stack deploy -c mssql-stack.yml mssql-stack
2) portainer interface mode (recommended)
Login portainer (if it is based on portainer above tutorial deployed browser to access http: // host IP: 9000 , additions mssql-stack.yml file in the stack)