More Related Content Similar to Windows Server 2016上でLinuxコンテナが動いた!
Similar to Windows Server 2016上でLinuxコンテナが動いた! (20) More from Takashi Kanai (6) Windows Server 2016上でLinuxコンテナが動いた!2. 自己紹介
• 名前:金井 崇
• 所属:株式会社IDCフロンティア
• 仕事:IaaSの基盤設計・構築・運用・提案を担当
• 興味:仮想化 コンテナ オールフラッシュ GPU FPGA
Chef Docker PowerShell VSCode Hadoop
• MVP:Cloud and Data Center Management (2017/03~)
• SNSなど:
• Facebook https://www.facebook.com/anikundesu
• Blog http://www.takanyan.net/
• Twitter @anikundesu
• LinkedIn https://jp.linkedin.com/in/takashikanai/ja
• SlideShare https://www.slideshare.net/anikundesu/presentations
2Copyright © 2017 System Center User Group Japan. All Rights Reserved.
3. 注意事項
本セッションは、Windows Server Insider Preview 16278での検証結果をもとに記述をしています。
正式版では挙動が異なる場合がありますので、ご留意ください。
本セッション資料は、個人で準備した環境において、個人的に実施した検証・結果を基に記載して
います。あくまで個人の意見・見解であり、所属する会社・組織及びマイクロソフト社とは関係が
ございません。所属する会社・組織・マイクロソフト社の正式な回答・見解ではない事に留意して
ください。
本資料を閲覧した事により問題が生じた場合、または問題が発生しかけた場合、または生じた一切
の不利益について、発表者は一切の責任を負う事はできませんのでご了承ください。
3Copyright © 2017 System Center User Group Japan. All Rights Reserved.
5. Windows Server Semi-Annual Release
1709のコンテナ向け新機能紹介
Section 1
5Copyright © 2017 System Center User Group Japan. All Rights Reserved.
6. Semi-Annualu Release 1709の新機能
<コンテナ関連でアナウンスされた新機能>
1. 新しいコンテナベースイメージ
– Nano Server:70%以上縮小され80MBに
– Server Core :20%以上縮小
2. コンテナがSMBボリュームのマウントをサポート
3. コンテナオーケストレーター向け基盤
– KubernetesクラスターでLinuxと同等のネットワーク機能をサポート
– Named pipe mapping対応
<正式アナウンスされていない新機能>
4. Hyper-Vコンテナー+LinuxKITでLinuxカーネルベースのコンテナに対応
6Copyright © 2017 System Center User Group Japan. All Rights Reserved.
7. Nano Serverはコンテナー専用
• Nano Serverは.NET Coreアプリケーションの動作に最適化
• PowerShell、.NET Core、WMIはデフォルト非搭載
– ユーザーが自分のコンテナーイメージを作る際にPowerShell
や.NET Coreコンテナパッケージを追加することは可能
• アップデートはDockerHub経由で新しいイメージを配布
• Nano ServerのトラブルシュートはDockerを使う
– “docker run (イメージ名) –ti cmd”など
• Windows IoT Core上でNano Serverのコンテナが起動可能
• Nano ServerのVMイメージは廃止
7Copyright © 2017 System Center User Group Japan. All Rights Reserved.
出典:Changes to Nano Server in the next release of Windows Server
https://docs.microsoft.com/en-us/windows-server/get-started/nano-in-semi-annual-channel
11. 【復習】Hyper-Vコンテナー
• 一つのコンテナに1つのOS
• Docker APIでHyper-Vの仮想環境を操作
11
Windowsホスト
OS Kernel VM1 VM2
Process1 Process2
Docker Engine
ホスト
Process
Docker Client
Docker API
Hyper-V
ゲスト1
Win Kernel
ゲスト2
Win Kernel
Copyright © 2017 System Center User Group Japan. All Rights Reserved.
12. Hyper-Vコンテナー上のLinuxKit
• 一つのコンテナに1つのLinuxKIT OS
• Docker APIでHyper-Vの仮想環境を操作
12
Windowsホスト
OS Kernel VM1 VM2
Docker Engine
ホスト
Process
Docker Client
Docker API
Hyper-V
ゲスト1 ゲスト2
Copyright © 2017 System Center User Group Japan. All Rights Reserved.
Process1 Process2
14. Docker for Windowsとの違い
• Hyper-V上にLinux仮想マシンを1つ作成(MobyLinuxVM)
• Docker APIでLinux仮想マシン上のコンテナを操作
14
Windowsホスト
OS Kernel VM
Docker Engine
ホスト
Process
Docker Client
Docker API
Hyper-V
Linux Kernel (MobyLinuxVM)
Linuxコンテナ
Process1
Linuxコンテナ
Process2
Copyright © 2017 System Center User Group Japan. All Rights Reserved.
16. Hyper-V
デモでやりたかったこと
• ホストOSをWindows Server Insider Preview build 16278
• Hyper-VコンテナーでLinuxKIT動作を「見せたい」
16
Windows Server
Insider 16278
OS Kernel VM1 VM2
Docker Engine
ホスト
Process
Docker Client
Docker API
ゲスト1 ゲスト2
Copyright © 2017 System Center User Group Japan. All Rights Reserved.
Process1 Process2
17. Semi-Annual Releaseの特徴
Desktopエクスペリエンスなし!
デモを「見せられない」
17Copyright © 2017 System Center User Group Japan. All Rights Reserved.
出典:Windows Server の半期チャネルの概要
https://docs.microsoft.com/ja-jp/windows-server/get-started/semi-annual-channel-overview
インストール オプション
半期チャネル
(Windows Server)
Long-term Servicing チャネル
(Windows Server 2016)
Nano Server 〇 ×
Server Core 〇 〇
デスクトップ搭載サーバー × 〇
18. Hyper-V(親)
Windows Server
2016
(Win2k16host) Nested Hyper-V (VM名:Win2016-build16278)
本日のデモ環境の構成
Nested Hyper-Vを使って1PCで実現
18
VM1 VM2
Docker Engine
ゲスト1 ゲスト2
Copyright © 2017 System Center User Group Japan. All Rights Reserved.
Process1 Process2
この
プレゼン
Windows Server
Insider 16278
(Win2016-Guest)
Docker Client
Docker API
19. Nested Hyper-V構築手順
1. Windows Server Insider用VM作成(OSはまだ不要)
2. NestedVMを有効にするScriptをダウンロード
https://github.com/MicrosoftDocs/Virtualization-
Documentation/blob/master/hyperv-tools/Nested/Enable-NestedVm.ps1
3. Scriptを1.の仮想マシン名を引数に指定して実行
19Copyright © 2017 System Center User Group Japan. All Rights Reserved.
PS D:¥> .¥Enable-NestedVm.ps1 【VM名】
This script will set the following for 【VM名】 in order to enable nesting:
Virtualization extensions will be enabled
Optionally enable mac address spoofing
Input Y to accept or N to cancel:Y
Mac Address Spoofing isn't enabled (nested guests won't have network).
Would you like to enable MAC address spoofing? (Y/N)Y
MACアドレスSpoofing
も有効にする
20. Windows Server Insider Previewセットアップ
1. Windows Insiderページから
ISOを入手
2. Nested VM上でServer Core
をインストール
3. インストール後、sconfigコ
マンドで初期設定
– ホスト名の設定
– IPアドレスなどNetwork設定
– Remote Desktop接続有効化
20Copyright © 2017 System Center User Group Japan. All Rights Reserved.
22. Hyper-Vコンテナー構築手順
1. Hyper-VとContainer機能を有効化とOS再起動
2. Docker 17.06.0-ceのインストールとOS再起動
22Copyright © 2017 System Center User Group Japan. All Rights Reserved.
PS C:¥> Install-WindowsFeature Hyper-V,Containers –IncludeManagementTools
PS C:¥> Restart-Comptuer -Force
PS C:¥> Install-Module -Name DockerMsftProviderInsider -Repository PSGallery -Force
PS C:¥> Install-Package -Name docker -ProviderName DockerMsftProviderInsider -
RequiredVersion 17.06.0-ce
Docker CE 17.06を明示的に指定しないと、Linuxベースの
コンテナが動かないです。(2017年9月30日時点)
23. LinuxKITとDockerデーモン準備
1. LinuxKITのダウンロードと展開
2. Linuxコンテナ on Windows対応Dockerデーモン展開
23Copyright © 2017 System Center User Group Japan. All Rights Reserved.
PS C:¥> mkdir "$Env:ProgramFiles¥Linux Containers"
PS C:¥> Invoke-WebRequest -UseBasicParsing -OutFile linuxkit.zip
https://github.com/friism/linuxkit/releases/download/preview-1/linuxkit.zip
PS C:¥> Expand-Archive linuxkit.zip -DestinationPath "$Env:ProgramFiles¥Linux Containers¥.“
PS C:¥> rm linuxkit.zip
PS C:¥> mkdir “$Env:ProgramFiles¥lcow” ←dockerデーモンのインストールフォルダ作成
PS C:¥> cd "$Env:ProgramFiles¥lcow"
PS C:¥Program Files¥lcow¥> Invoke-WebRequest -UseBasicParsing -OutFile dockerd.exe
https://master.dockerproject.org/windows/x86_64/dockerd.exe
PS C:¥Program Files¥lcow¥> mkdir C:¥lcow ←コンテナイメージの保存フォルダを事前作成
24. DEMO:Linuxコンテナ on Windows
1. Linuxコンテナ起動用Dockerデーモンの起動
2. Linuxコンテナの起動
3. Windowsコンテナ起動用Dockerデーモンと比較
24Copyright © 2017 System Center User Group Japan. All Rights Reserved.
25. Linuxコンテナ起動用Dockerデーモンの起動
1. リモートからPowerShell接続してデーモン起動
2. RDPまたはローカルの「コマンドプロンプト」でLinux
カーネルベースのコンテナを起動
25Copyright © 2017 System Center User Group Japan. All Rights Reserved.
PS C:¥> Enter-PSSession -Computername 【接続先IP】 -Credential Administrator
[【接続先IP】 ]: PS C:¥Users¥Administrator¥Documents> cd "$Env:ProgramFiles¥lcow¥”
[【接続先IP】 ]: PS C:¥Program Files¥lcow> $Env:LCOW_SUPPORTED=1
[【接続先IP】 ]: PS C:¥Program Files¥lcow> .¥dockerd.exe -D --experimental -H
"npipe:////./pipe//docker_lcow" --data-root c:¥lcow
C:¥> docker -H "npipe:////./pipe//docker_lcow" run -ti busybox sh
/ # (←Linuxベースのコンテナでシェルが起動)
26. Windowsコンテナ起動用Dockerデーモンと比較
C:¥> docker -H "npipe:////./pipe//docker_lcow" version
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:30:30 2017
OS/Arch: windows/amd64
Server:
Version: master-dockerproject-2017-09-29
API version: 1.33 (minimum version 1.24)
Go version: go1.8.3
Git commit: ab2b03a
Built: Fri Sep 29 23:51:45 2017
OS/Arch: windows/amd64
Experimental: true
C:¥> docker version
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:30:30 2017
OS/Arch: windows/amd64
Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.24)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 22:19:00 2017
OS/Arch: windows/amd64
Experimental: false
26Copyright © 2017 System Center User Group Japan. All Rights Reserved.
LCOW対応版Dockerデーモン 通常のWindows用Dockerデーモン
28. まとめ
• Windows Server Semi-Annualu Release 1709はDesktop機能な
しでリリース。
• Windows ServerはWindowsだけではなくLinuxのコンテナにも対
応。オーケストレーターとしてKubernetesをサポートする。
• Linux Kernelベースのコンテナを実行するため、Hyper-Vコンテナ
でLinuxKIT(コンテナ実行用の極小Linux)を利用している。
28Copyright © 2017 System Center User Group Japan. All Rights Reserved.
29. 参考資料
• PREVIEW: LINUX CONTAINERS ON WINDOWS
https://blog.docker.com/2017/09/preview-linux-containers-on-windows/
• Sneak peek #3: Windows Server, version 1709 for developers
https://blogs.technet.microsoft.com/windowsserver/2017/09/13/sneak-peek-3-windows-server-version-1709-for-
developers/
• Windows Networking at Parity with Linux for Kubernetes
https://www.cncf.io/blog/2017/09/08/windows-networking-parity-linux-kubernetes/
• Windows Server の半期チャネルの概要
https://docs.microsoft.com/ja-jp/windows-server/get-started/semi-annual-channel-overview
• Windows Insider Preview: Nested Virtualization
https://blogs.technet.microsoft.com/virtualization/2015/10/13/windows-insider-preview-nested-virtualization/
• Run Hyper-V in a Virtual Machine with Nested Virtualization
https://docs.microsoft.com/ja-jp/virtualization/hyper-v-on-windows/user-guide/nested-virtualization
• Changes to Nano Server in the next release of Windows Server
https://docs.microsoft.com/en-us/windows-server/get-started/nano-in-semi-annual-channel
29Copyright © 2017 System Center User Group Japan. All Rights Reserved.