2. 自己紹介
高井 一輝 (Takai Kazuki)
某ISP勤務
クラウドサービスの開発、設計、設備維持
Windows Server / System Center / Linux / etc…
Microsoft MVP - Cloud and Datacenter Management
System Center User Group Japan (SCUGJ)
Twitter : @zhuky7 / Facebook : kazuki.takai
Blog : http://operationslab.wordpress.com/
5. ところで…
利用中の Windows Server 人数 % (/108)
Windows Server SAC 4 3.7
Windows Server 2016 85 78.7
Windows Server 2012 R2 95 88.0
Windows Server 2012 29 26.9
Windows Server 2008 R2 55 50.9
Windows Server 2008 17 15.7
Windows Server 2003 / 2003 R2 11 10.2
それ以前のバージョンを使用中 4 3.7
10. Demo
docker images
docker search microsoft
docker run -it --isolation hyperv microsoft/windowsservercore-insider powershell
docker run -it --isolation hyperv microsoft/nanoserver cmd /c date /T
docker run -it --isolation hyperv microsoft/nanoserver:10.0.14393.2430_ja-jp cmd /c date /T
cd C:¥Users¥Administrators¥Documents¥work¥
docker build --isolation hyperv -t wsc-insider-iis .
http://localhost/
docker run --isolation hyperv -d -p 80:80 wsc-insider-iis
http://localhost/
Windows Containers
11. Containers と VM の違い
Containers = operating system virtualization Traditional virtual machines = hardware virtualization
OS
Kernel
Applications
Container Container Container
Hardware Hardware
OS
Application
VM VM VM
App
OS
App
OS
App
OS
12. Containers と VM の違い
VM (Virtual Machine)
ハードウェアを仮想化
OS の実行空間を分離
Containers
OS(の一部)を仮想化
アプリケーションの実行空間を分離
19. 2種類の Containers
Windows Server containers
通常の(一般的な)Containers
Container は、ホスト OS の kernel を使用
Hyper-V containers と比べて軽量(オーバーヘッドが少ない)
所謂 Linux の Containers と同じ
Hyper-V containers
Hyper-V の機能を利用してリソース隔離した Containers
Container は、独自の OS kernel を使用
Windows Server containers と比べて、分離レベルが高い(オーバーヘッドは多い)
20. どちらを使うか?
今のところは Hyper-V containers を推奨
Windows Server containers の場合、ホストと Container の OS バージョンを、完全に一致させる必要がある
動いたとしても、Microsoft のサポート対象外
Nano Server ベースのイメージを使用するには Hyper-V containers が必要となる
ベース kernel が異なる
Windows Server Core ベースのイメージはサイズが大きい
今後、Linux ベースのイメージを使用する場合も Hyper-V containers が必要となる
そもそも別の OS ですし…
Client containers (Containers on Windows 10) は Hyper-V containers のみサポート
docker run -it --isolation process microsoft/windowsservercore powershell
C:¥Program Files¥Docker¥Docker¥Resources¥bin¥docker.exe: Error response from daemon: Windows client operating
systems only support Hyper-V containers.
21. Demo
ROM microsoft/windowsservercore-insider
RUN powershell -Command `
Add-WindowsFeature Web-Server; `
Invoke-WebRequest -UseBasicParsing -Uri
"https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.3/Service
Monitor.exe" -OutFile "C:¥ServiceMonitor.exe"
EXPOSE 80
ENTRYPOINT ["C:¥¥ServiceMonitor.exe", "w3svc"]
Windows Containers
22. Windows Containers を使う
まずは
https://docs.microsoft.com/en-
us/virtualization/windowscontainers/about/
Windows 10
Hyper-V 及び Containers の機能をインストール
Docker for Windows (Desktop Tool) をインストール
必要であれば Experimental サポートを有効化
https://store.docker.com/editions/community/do
cker-ce-desktop-windows?tab=description
23. Windows Containers を使う
Windows Server
DockerMsftProvider or DockerProvider PS Module をインストール
docker パッケージをインストール
再起動
https://docs.microsoft.com/ja-jp/virtualization/windowscontainers/quick-
start/quick-start-windows-server
https://docs.microsoft.com/ja-jp/virtualization/windowscontainers/quick-
start/using-insider-container-images
24. 確認ポイント
docker version
Client version / Server (docker engine) version
Experimental
docker info
Default Isolation
Kernel Version
Experimental
25. Windows 環境向け Docker client
(現時点で)Windows 環境向けに特異な docker client option
--isolation
分離モードの指定
--isolation hyperv // クライアント OS のデフォルト
--isolation process // サーバー OS のデフォルト
--platform
(Windows Host 上で)どの OS kernel を使用するかの指定
--platform=linux // LCOW を使用
--platform=windows // Windows を使用
26. Demo
docker version
docker images
docker search alpine
docker pull alpine # will be failed
docker search microsoft/nanoserver-insider
docker pull microsoft/nanoserver-insider
docker run -it microsoft/nanoserver-insider cmd /c ver # will be failed
docker info
docker run --isolation hyperv -it microsoft/nanoserver-insider cmd /c ver
cmd /c ver
docker ps -a
docker rm
Configure container host
27. Linux containers on Windows hosts
Windows Host で Linux ベースの Container Image を実行可能
Windows Server 2016 では利用不可
Windows Server 1709 + Docker (CE) 17.11
Side-by-side 実行不可能(Docker engine 単位で単一)
手動設定
Windows Server 1709 + Docker (CE) 18.02
Side-by-side 実行可能
手動設定
Windows Server 1803 + Docker (CE) 18.03
Side-by-side 実行可能
ほぼ自動設定
28. Demo docker version
docker info
docker search alpine
docker pull alpine
docker run -it alpine sh
uname -a
Running Linux containers
30. まとめ
Windows Containers
OS virtualization
Hyper-V isolation
Containers の使い始め方
PowerShell たたけば OK
Container の真髄は、自動化、デプロイ・リリースサイクルの迅速化
Kubernetes との連携についても要注目
31. 参考資料
Containers 101 with Microsoft and Docker
https://channel9.msdn.com/Blogs/containers/Containers-101-with-Microsoft-
and-Docker?ocid=player
Docker for Windows Stable Release notes
https://docs.docker.com/docker-for-windows/release-notes/
Install Docker Enterprise Edition for Windows Server
https://docs.docker.com/install/windows/docker-ee/