Window Containers Hello SQL Express
安裝設定 Step by Step
啟用服務
以下指令皆為 Power ShellEnable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -all
Enable-WindowsOptionalFeature -Online -FeatureName containers –all
ps : 執行後須重開機下載Docker
$version = (Invoke-WebRequest -UseBasicParsing https://raw.githubusercontent.com/docker/docker/master/VERSION).Content.Trim()
Invoke-WebRequest "https://master.dockerproject.org/windows/amd64/docker-$($version).zip" -OutFile "$env:TEMP\docker.zip" -UseBasicParsing
安裝Docker
Expand-Archive -Path "$env:TEMP\docker.zip" -DestinationPath $env:ProgramFiles
註冊為Service
$env:path +=";c:\program files\Docker"
[Environment]::SetEnvironmentVariable("Path",$env:Path+"C:\Program Files\Docker",[EnvironmentVariableTarget]::Machine)
dockerd --register-service
Start-Service Docker
到此步驟已完成安裝。
SQL Server 2016 Express 版的 Windows 容器
安裝完後,當然是要找個容器來執行看看。下載Image檔
docker pull microsoft/mssql-server-2016-express-windows
執行SQL Express
docker run -d -p 1433:1433 --env sa_password=CK@28000543 microsoft/mssql-server-2016-express-windows
ps:env 初始化密碼其它資訊
查詢執行中的Containerdocker ps
查看Container的IP Address
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' b037877976aa
防火牆允許port 1433
New-NetFirewallRule -DisplayName "SQL Engine" -Direction Inbound -LocalPort 1433 -Protocol TCP -Action Allow
設定完後,使用Client 工具測試連接
參考來源
https://blogs.technet.microsoft.com/technet_taiwan/2016/11/04/windows-on-sqlserver2016express/http://www.slideshare.net/WillHuangTW/windows-container-technical-preview