1、Docker、Docker-Compose安装

https://www.cnblogs.com/a120608yby/p/9883175.html
https://www.cnblogs.com/a120608yby/p/14582853.html

2、基于Docker-Compose部署SQL Server

# vim docker-compose.yml 
version: '3.9'
services:
  mssql:
    container_name: mssql
    image: mcr.microsoft.com/mssql/server:2022-latest
    hostname: mssql
    ports:
      - 1433:1433
    restart: always
    networks:
      - ops_default
    environment:
      - ACCEPT_EULA=Y
      - MSSQL_SA_PASSWORD=Admin-123
      - MSSQL_COLLATION=Chinese_PRC_BIN
      - TZ=Asia/Shanghai
    volumes:
      - ./mssql_data:/var/opt/mssql

networks:
  ops_default:
    external: true

# 创建数据目录并授权
mkdir mssql_data
chown -R 10001.10001 mssql_data

3、启动服务

docker compose up -d

4、查看服务启动状态

docker-compose ps

5、客户端安装和访问

参考:

https://learn.microsoft.com/zh-cn/sql/linux/quickstart-install-connect-docker?view=sql-server-linux-ver16&pivots=cs1-bash
https://github.com/microsoft/go-sqlcmd/releases
https://learn.microsoft.com/zh-cn/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver16

  

posted on 2024-01-09 12:57  a120608yby  阅读(92)  评论(0编辑  收藏  举报