注意:此问题已在GitHub here上报告,目前尚无任何解决方案。
平台信息:Hyper-V在ESX 6.0上启用了Windows 2016 Server TP4 guest虚拟机,具有6GB RAM和80GB硬盘。
我跟着"Deploy a Windows Container Host to a New Hyper-V Virtual Machine" quickstart,但过程总是失败,如下所示:
PS C:\Windows\system32> powershell.exe -NoProfile c:\New-ContainerHost.ps1 -VMName testcont -WindowsImage ServerDatacenterCore -Hyperv
cmdlet New-ContainerHost.ps1 na posição de comando 1 do pipeline
Forneça valores para os seguintes parâmetros:
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 [?] Ajuda (o padrão é "N"): y
Using VHD path C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks
Using external switch vmxnet3 Ethernet 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 testcont...
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 F...
Enabling Hyper-V feature on drive F...
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 testcont...
Configuring VM testcont...
Connecting VM to switch vmxnet3 Ethernet Adapter - Virtual Switch
AVISO: A virtualização aninhada é um recurso de visualização sem suporte. Os hipervisores que não forem o hipervisor do
Hyper-V em execução em uma máquina virtual convidada provavelmente falharão. Além disso, alguns recursos do Hyper-V
são incompatíveis com a virtualização aninhada, como memória dinâmica, pontos de verificação e salvar/restaurar.
Starting VM testcont...
Waiting for VM testcont to boot...
Connected to VM testcont 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...
C:\Install-ContainerHost.ps1 : Image NanoServer not found after 5 minutes
At line:1 char:1
+ C:\Install-ContainerHost.ps1 -PSDirect -NATSubnetPrefix 172.16.0.0/24 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-ContainerHost.ps1
C:\New-ContainerHost.ps1 : Install-ContainerHost.ps1 failed in the VM
No linha:1 caractere:1
+ c:\New-ContainerHost.ps1 -VMName testcont -WindowsImage ServerDatacen ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-ContainerHost.ps1
我很无奈。任何帮助将不胜感激。
答案 0 :(得分:0)
我必须自己解决这个问题所以我可以告诉你我必须做些什么...
问题是在Install-ContainerHost.ps1中有一行,这是由New-ContainerHost.ps1运行的文件
您可以从here
获取该安装文件在其中,需要更换以下行以阻止发生错误:
$newBaseImages = Get-InstalledContainerImage $BaseImageName
该行可以替换为以下行:
$newBaseImages = Get-ContainerImage
完成并保存它(我在C :)中将New-ContainerHost.ps1与我一起保存,然后您可以通过在命令中包含-ScriptPath选项来告诉New-ContainerHost.ps1文件使用它'正在运行:
powershell.exe -NoProfile c:\New-ContainerHost.ps1 -VMName testcont -WindowsImage ServerDatacenterCore -Hyperv -ScriptPath C:\Install-ContainerHost.ps1
另外需要注意的事项 - 您可能需要使用Set-ExecutionPolicy临时修改执行策略,或者在Powershell允许您运行之前签署修改后的ps1文件,具体取决于系统的执行策略当前设置为
那对我而言。希望它可以帮到你。