少し前まで、Windows Server 2016 TP 4 で、Hyper-V Container がプレビューとして提供されていたことに気づいていませんでした。。。。
Hyper-V Container を含め、Windows Server Container をちょっといじってみました。
参考にしたのは、下記のサイトです。
https://msdn.microsoft.com/virtualization/windowscontainers/containers_welcome
自分は、物理マシンにWindows Server 2016 TP 4 をインストールして、Hyper-V がインストールされている環境がありましたので、この環境を使ってContainer HOSTは、仮想マシンに作成しました。
この手順は、「Deploy a Windows Container Host to a New Hyper-V Virtual Machine」の記述の通りですね。
https://msdn.microsoft.com/ja-jp/virtualization/windowscontainers/quick_start/container_setup
ただ、自分の環境はDisk IO がとても悪い環境にあり、New-ContainerHost.ps1 の中で30分応答がないとエラーで抜ける処理があるのですが、そこを60分に変更しちゃいました。。。
自分がやった時のログです。
PS C:Windowssystem32> Get-VMSwitch | where {$_.SwitchType -eq "External" } Name SwitchType NetAdapterInterfaceDescription ---- ---------- ------------------------------ Qualcomm Atheros AR9485WB-EG Wireless Network Adapter - Virtual Switch External Qualcomm Atheros AR9485WB-EG Wir... PS C:Windowssystem32> wget -uri https://aka.ms/tp4/New-ContainerHost -OutFile c:New-ContainerHost.ps1 PS C:Windowssystem32> C:New-ContainerHost.ps1 -VmName ConHV03 -WindowsImage ServerDataCenterCore -Hyperv cmdlet New-ContainerHost.ps1 at command pipeline position 1 Supply values for the following parameters: Password: ******** Before installing and using the Windows Server Technical Preview 4 with Containers virtual machine you must: 1. Review the license terms by navigating to this link: http://aka.ms/tp4/containerseula 2. Print and retain a copy of the license terms for your records. By downloading and using the Windows Server Technical Preview 4 with Containers virtual machine you agree to such license terms. Please confirm you have accepted and agree to the license terms. [N] No [Y] Yes [?] Help (default is "N"): Y Using VHD path C:UsersPublicDocumentsHyper-VVirtual Hard Disks Using external switch Qualcomm Atheros AR9485WB-EG Wireless Network Adapter - Virtual Switch The latest ServerDataCenterCore VHD is already present on this system. ServerDataCenterCore Container OS Image (WIM) is already present on this system. Creating VHD files for VM ConHV03... VHD mount must be synchronized with other running instances of this script. Waiting for exclusive access... Mounting ServerDataCenterCore VHD for offline processing... Enabling Containers feature on drive G... Enabling Hyper-V feature on drive G... Copying Docker into ServerDataCenterCore VHD... Copying NSSM into ServerDataCenterCore VHD... This script uses a third party tool: NSSM. For more information, see https://nssm.cc/usage Downloading NSSM... Extracting NSSM from archive... Writing default unattend.xml... Copying Install-ContainerHost.ps1 into ServerDataCenterCore VHD... Dismounting VHD... Creating VM ConHV03... Configuring VM ConHV03... Connecting VM to switch Qualcomm Atheros AR9485WB-EG Wireless Network Adapter - Virtual Switch WARNING: Nested virtualization is an unsupported preview feature. Hypervisors other than the Hyper-V hypervisor running in a guest virtual machine are likely to fail. Furthermore, some Hyper-V features are incompatible with nested virtualization, such as dynamic memory, checkpoints, and save/restore. Starting VM ConHV03... Waiting for VM ConHV03 to boot... Connected to VM ConHV03 Heartbeat IC. Waiting for specialization to complete (this may take a few minutes)... Executing Install-ContainerHost.ps1 inside the VM... Completing container install... Querying status of Windows feature: Containers... Feature Containers is already enabled. Querying status of Windows feature: Hyper-V... Feature Hyper-V is already enabled. Waiting for Hyper-V Management... Enabling container networking... Creating container switch (NAT)... Creating NAT for 172.16.0.0/24... Installing Container OS image from D:WindowsServerCore.wim (this may take a few minutes)... Container base image install complete. Querying container images... Waiting for VMMS to return image at (12/11/2015 16:12:52)... Waiting for VMMS to return image at (12/11/2015 16:12:55)... Installing ContainerProvider package... Getting Container OS image (NanoServer) from OneGet (this may take a few minutes)... Waiting for VMMS to return image at (12/11/2015 16:26:48)... The following images are present on this machine: ContainerImage (Name = 'NanoServer') [Publisher = 'CN=Microsoft', Version = '10.0.10586.0'] ContainerImage (Name = 'WindowsServerCore') [Publisher = 'CN=Microsoft', Version = '10.0.10586.0'] Installing Docker... Creating Docker program data... NSSM is already installed Configuring NSSM for Docker service... Waiting for Docker daemon... Successfully connected to Docker Daemon. Tagging new base image (8572198a60f1)... Base image is now tagged: nanoserver 10.0.10586.0 8572198a60f1 6 weeks ago 0 B nanoserver latest 8572198a60f1 6 weeks ago 0 B Tagging new base image (6801d964fda5)... Base image is now tagged: windowsservercore 10.0.10586.0 6801d964fda5 6 weeks ago 0 B windowsservercore latest 6801d964fda5 6 weeks ago 0 B Script complete! Cleaning up temporary WIM VHD VM ConHV03 is ready for use as a container host. See https://msdn.microsoft.com/virtualization/windowscontainers/containers_welcome for more information about using Containers. The source code for these installation scripts is available here: https://github.com/Microsoft/Virtualization-Documentation/tree/master/windows-server-container-tools PS C:Windowssystem32>
自分が試した時は、nanoserverのイメージが正しく作れなくてエラーになったのですが、スイッチを間違えたかなとか色々試したのですが、結局同じコマンドを実行したらうまくできました。。。
(原因なんだったのか、よくわからないです)
これで、コンテナホストとなる仮想マシンができました。
仮想マシンに入ると、Server Core な感じでコマンドプロンプトしかない画面となります。
そこで、PowerShell を起動して、Get-ContainerImage を動かしてみると、nanoserver と windowsservercore の2つのイメージが見えるはずです。
まだドキュメントを斜め読みにしただけですけど、Hyper-V Container はこの辺のドキュメントを読めばできそうな感じです。
https://msdn.microsoft.com/ja-jp/virtualization/windowscontainers/management/hyperv_container
RuntimeType で、Hyper-V Container と Windows Server Container を切り替えるような感じなのかな??
せっかくホスト作ったので、今度はコンテナイメージも触ってみようかな。。
コメント