Windows container quickstart: Install-ContainerHost.ps1 fails with message “Image NanoServer not found after 5 minutes”
Note: This issue has already been reported on GitHub here without any solution so far.
Platform info: Hyper-V enabled Windows 2016 Server TP4 guest on ESX 6.0 with 6GB of RAM and a 80GB hard-disk.
I followed the “Deploy a Windows Container Host to a New Hyper-V Virtual Machine” quickstart but the process always fails as listed below:
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
I’m helpless. Any help would be appreciated.
One Solution collect form web for “Windows container quickstart: Install-ContainerHost.ps1 fails with message “Image NanoServer not found after 5 minutes””
I just had to get past this issue myself so I can tell you what I had to do…
The issue’s with a line in Install-ContainerHost.ps1 which is a file run by New-ContainerHost.ps1
You can get that Install file from here
Inside it there’s the following line that needs to be replaced to stop that error occurring:
$newBaseImages = Get-InstalledContainerImage $BaseImageName
That line can be replaced with the line below:
$newBaseImages = Get-ContainerImage
Having done that and saved it (I saved mine alongside New-ContainerHost.ps1 in C:), you can then tell the New-ContainerHost.ps1 file to make use of it by including a -ScriptPath option in the command you’re running:
powershell.exe -NoProfile c:\New-ContainerHost.ps1 -VMName testcont -WindowsImage ServerDatacenterCore -Hyperv -ScriptPath C:\Install-ContainerHost.ps1
One other thing to look out for – you may need to temporarily amend your execution policy with Set-ExecutionPolicy or sign that modified ps1 file before Powershell will allow you to run it, depending on what your system’s Execution Policy is currently set as.
That was it for me. Hope it helps you.