DevOps
  • DevOps
  • Docker
    • Overview
  • Vagrant
    • Overview
    • Installation
    • Basic Commands
    • Vagrantfile
      • Example
    • Deploying Multiple Machine
    • Distribution
    • Reference
  • Running SQL Server on Windows Docker
    • Introduction
      • Windows Container & Hyper-V Container
    • System Requirements and Prerequisites
    • Version Compatibility
    • Enable Hyper-V & Containers and Install Docker on Window Servers
    • Using Docker to Run MSSQL Image
    • Install SSMS for remoting MSSQL Server Image
    • Using Docker-Compose to Build Up a MSSQL Image
    • Increase the default Windows container's storage
    • Reference
    • Appendix
  • Kubernetes
    • Install Kubernetes with kubeasz
    • Use Hyper-V Manager to create VM for K8S
      • Specification of the VM
      • Use Hyper-V Manager to turn on a VM for K8S
    • Installation
      • Install VirtualBox and its extension on Ubuntu
      • Install kubectl
      • Install minikube
    • Getting Started
      • Running Kubernetes Locally via Minikube
    • Assign Memory Resources to Containers and Pods
    • Assign CPU Resources to Containers and Pods
    • Quality of Services (QoS)
    • Volume for Storage
      • Configure a Pod to Use a Volume for Storage
      • *Configure a Pod to Use a PersistentVolume for Storage
    • In a nutshell...
    • Reference
  • Ansible
    • What is Ansible?
    • Set Up OS Environments for Ansible
    • Install Ansible
    • Structure for ansible
      • Inventory
      • Playbook
      • Modules
      • Variables
      • Conditions
    • Security - Ansible Fault
    • 實際操作測試1 - 使用ssh
    • 實際操作測試2 - Docker容器部署
    • Appendix
    • Reference
  • Azure
    • Overview
    • Terms
    • Getting Started
    • Azure DevOps Services
    • Reference
Powered by GitBook
On this page
  • Install docker-compose
  • dockerfile structure
  • Run docker-compose

Was this helpful?

  1. Running SQL Server on Windows Docker

Using Docker-Compose to Build Up a MSSQL Image

Install docker-compose

In powershell with Admin right:

# since GitHub now requires TLS1.2, run the following:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Download docker-compose
Invoke-WebRequest "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-Windows-x86_64.exe" -UseBasicParsing -OutFile $Env:ProgramFiles\Docker\docker-compose.exe

Test installation:

docker-compose --version

docker-compose version 1.24.0, build 01110ad01

dockerfile structure

version: '3'
services:
 
  sqlserver:
    image: microsoft/mssql-server-windows-developer:latest-14393
    container_name: sqlserver2
    ports:
      ["1433:1433"]
    volumes:
      - c:\MSSQL Data:c:\MSSQL Data
    environment:
      sa_password: Atalces!1
      accept_eula: Y
      # the container will attach to the host's database 
      attach_dbs: "[{'dbName':'trunk','dbFiles':['c:\\\\MSSQL Data\\\\trunk.mdf','c:\\\\MSSQL Data\\\\trunk_Log.ldf']}]"
    networks:
      default:
        ipv4_address: 172.20.32.244
        aliases:
          - qsql
  
networks:
  default:
    external:
      name: nat

Run docker-compose

Route to the folder which contains the docker-compose.yml file, run the following:

docker-compose up -d

PreviousInstall SSMS for remoting MSSQL Server ImageNextIncrease the default Windows container's storage

Last updated 6 years ago

Was this helpful?