Machine: Waiting for host to start... (hyperv)

Created on 7 Dec 2017  ·  16Comments  ·  Source: docker/machine

_I left this issue open only for a while and will keep several days before closing if nobody gonna report again. I'll reopen it once the problem rise again. If you see the issue is closed feel free to leave your questions below anyway._

SOLVED: At first try to stop using --hyperv-memory cause it is fails to start up your vm even if it is adjusted via hyper-v-manager. Also, you should specify --hyperv-virtual-switch explicitly to allow docker to connect properly. If it still doesn't work then try to remove virtual switch bridge manually via _windows network adapters_ settings and create it once again by using _hyper-v manager_.
See also another solution below


Hangs on when I'm creating new virtual machine.
I followed several similar issues for virtualbox like #3826 but with no luck.

Setup

windows 10 x64
boot2docker - v17.11.0-ce
docker - 17.11.0-ce

Virtual switch is enabled via Hyper-V manager as described here

Steps to reproduce

1 Install docker & Enable hyper-v feature in windows features
2 Enable Virtual Switch
3 $ docker-machine create -d hyperv --hyperv-memory 512 vm1
4 Hangs forever

screenshot_3

I also tried to use --debug flag with the same command and got this (clickable) output:

Docker Machine Version:  0.13.0, build 9ba6da9
Found binary path at C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe
Launching plugin server for driver hyperv
Plugin server listening at address 127.0.0.1:56251
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(flag-lookup) Calling .GetMachineName
(flag-lookup) Calling .DriverName
(flag-lookup) Calling .GetCreateFlags
Found binary path at C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe
Launching plugin server for driver hyperv
Plugin server listening at address 127.0.0.1:56255
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(vm1) Calling .GetMachineName
(vm1) Calling .DriverName
(vm1) Calling .GetCreateFlags
(vm1) Calling .SetConfigFromFlags
(vm1) Calling .PreCreateCheck
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @(Get-Command Get-VM).ModuleName
(vm1) DBG | [stdout =====>] : Hyper-V
(vm1) DBG |
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole("Hyper-V Administrators")
(vm1) DBG | [stdout =====>] : False
(vm1) DBG |
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
(vm1) DBG | [stdout =====>] : True
(vm1) DBG |
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (Get-VMSwitch).Name
(vm1) DBG | [stdout =====>] : DockerNAT
(vm1) DBG | DVS
(vm1) DBG |
(vm1) DBG | [stderr =====>] :
(vm1) DBG | local Boot2Docker ISO version:  v17.11.0-ce
(vm1) Calling .GetConfigRaw
(vm1) Calling .Create
(vm1) DBG | local Boot2Docker ISO version:  v17.11.0-ce
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (Get-VMSwitch).Name
(vm1) DBG | [stdout =====>] : DockerNAT
(vm1) DBG | DVS
(vm1) DBG |
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
(vm1) DBG | [stdout =====>] : True
(vm1) DBG |
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive New-VHD -Path 'C:\Users\Alex\.docker\machine\machines\vm1\fixed.vhd' -SizeBytes 10MB -Fixed
(vm1) DBG | [stdout =====>] :
(vm1) DBG |
(vm1) DBG | ComputerName            : RHEA
(vm1) DBG | Path                    : C:\Users\Alex\.docker\machine\machines\vm1\fixed.vhd
(vm1) DBG | VhdFormat               : VHD
(vm1) DBG | VhdType                 : Fixed
(vm1) DBG | FileSize                : 10486272
(vm1) DBG | Size                    : 10485760
(vm1) DBG | MinimumSize             :
(vm1) DBG | LogicalSectorSize       : 512
(vm1) DBG | PhysicalSectorSize      : 512
(vm1) DBG | BlockSize               : 0
(vm1) DBG | ParentPath              :
(vm1) DBG | DiskIdentifier          : 03143A6A-646C-4DDC-AEBA-469A41EC764C
(vm1) DBG | FragmentationPercentage : 0
(vm1) DBG | Alignment               : 1
(vm1) DBG | Attached                : False
(vm1) DBG | DiskNumber              :
(vm1) DBG | Number                  :
(vm1) DBG |
(vm1) DBG |
(vm1) DBG |
(vm1) DBG |
(vm1) DBG | [stderr =====>] :
(vm1) DBG | Writing magic tar header
(vm1) DBG | Writing SSH key tar header
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Convert-VHD -Path 'C:\Users\Alex\.docker\machine\machines\vm1\fixed.vhd' -DestinationPath 'C:\Users\Alex\.docker\machine\machines\vm1\disk.vhd' -VHDType Dynamic -DeleteSource
(vm1) DBG | [stdout =====>] :
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Resize-VHD -Path 'C:\Users\Alex\.docker\machine\machines\vm1\disk.vhd' -SizeBytes 20000MB
(vm1) DBG | [stdout =====>] :
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive New-VM vm1 -Path 'C:\Users\Alex\.docker\machine\machines\vm1' -SwitchName 'DockerNAT' -MemoryStartupBytes 512MB
(vm1) DBG | [stdout =====>] :
(vm1) DBG | Name State CPUUsage(%) MemoryAssigned(M) Uptime   Status             Version
(vm1) DBG | ---- ----- ----------- ----------------- ------   ------             -------
(vm1) DBG | vm1  Off   0           0                 00:00:00 Operating normally 8.0
(vm1) DBG |
(vm1) DBG |
(vm1) DBG |
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Set-VMDvdDrive -VMName vm1 -Path 'C:\Users\Alex\.docker\machine\machines\vm1\boot2docker.iso'
(vm1) DBG | [stdout =====>] :
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Add-VMHardDiskDrive -VMName vm1 -Path 'C:\Users\Alex\.docker\machine\machines\vm1\disk.vhd'
(vm1) DBG | [stdout =====>] :
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Start-VM vm1
(vm1) DBG | [stdout =====>] :
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM vm1 ).state
(vm1) DBG | [stdout =====>] : Running
(vm1) DBG |
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM vm1 ).networkadapters[0]).ipaddresses[0]
(vm1) DBG | [stdout =====>] :
(vm1) DBG | [stderr =====>] :
(vm1) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM vm1 ).state
(vm1) DBG | [stdout =====>] : Running


I also tried to remove user/.docker/machine/cache/boot2docker.iso and create vm again but didn't help. The machine hangs anyway.

Most helpful comment

I also encountered this issue, and fixed it, I think the root cause is: the document is unclear.
to solve this:
Please make sure you have selected the correct network
There are several networks in the list, but probably there is only one is enabled
You may check the status in: Control Panel\Network and Internet\Network Connections
You may also get here through: Network and Sharing Center/Change adapter settings

See following picture for detailed explanation:
image

All 16 comments

I have the similar issue, except my machine starts and it never gets an IP address, even though I followed everything from docs.

docker --version: Docker version 17.12.0-ce-rc3, build 80c8033
docker-machine --version: docker-machine.exe version 0.13.0, build 9ba6da9

This is on edge, same thing happens on stable.

Although, I noticed I can't run windows containers for some reason, so it looks like something is wrong with my current setup.
win 10 build: 17025

docker-machine --debug -d "hyperv" --hyperv-virtual-switch "BridgedConnection" worker3

Found binary path at C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe
Launching plugin server for driver hyperv
Plugin server listening at address 127.0.0.1:49302
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(flag-lookup) Calling .GetMachineName
(flag-lookup) Calling .DriverName
(flag-lookup) Calling .GetCreateFlags
Found binary path at C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe
Launching plugin server for driver hyperv
Plugin server listening at address 127.0.0.1:49306
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(worker3) Calling .GetMachineName
(worker3) Calling .DriverName
(worker3) Calling .GetCreateFlags
(worker3) Calling .SetConfigFromFlags
Running pre-create checks...
(worker3) Calling .PreCreateCheck
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @(Get-Command Get-VM).ModuleName
(worker3) DBG | [stdout =====>] : Hyper-V
(worker3) DBG |
(worker3) DBG | [stderr =====>] :
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole("Hyper-V Administrators")
(worker3) DBG | [stdout =====>] : False
(worker3) DBG |
(worker3) DBG | [stderr =====>] :
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
(worker3) DBG | [stdout =====>] : True
(worker3) DBG |
(worker3) DBG | [stderr =====>] :
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (Get-VMSwitch).Name
(worker3) DBG | [stdout =====>] : nat
(worker3) DBG | Default Switch
(worker3) DBG | BridgedSwitch
(worker3) DBG |
(worker3) DBG | [stderr =====>] :
(worker3) DBG | local Boot2Docker ISO version:  v17.09.1-ce
(worker3) Calling .GetConfigRaw
Creating machine...
(worker3) Calling .Create
(worker3) DBG | local Boot2Docker ISO version:  v17.09.1-ce
(worker3) Copying C:\Users\McMau\.docker\machine\cache\boot2docker.iso to C:\Users\McMau\.docker\machine\machines\worker3\boot2docker.iso...
(worker3) Creating SSH key...
(worker3) Creating VM...
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (Get-VMSwitch).Name
(worker3) DBG | [stdout =====>] : nat
(worker3) Using switch "BridgedSwitch"
(worker3) DBG | Default Switch
(worker3) DBG | BridgedSwitch
(worker3) DBG |
(worker3) DBG | [stderr =====>] :
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principa
l.WindowsBuiltInRole] "Administrator")
(worker3) DBG | [stdout =====>] : True
(worker3) DBG |
(worker3) DBG | [stderr =====>] :
(worker3) Creating VHD
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive New-VHD -Path 'C:\Users\McMau\.docker\machine\machines\worker3\fixed.vhd' -SizeBytes 10MB -Fixed
(worker3) DBG | [stdout =====>] :
(worker3) DBG |
(worker3) DBG | ComputerName            : BIZNISPC
(worker3) DBG | Path                    : C:\Users\McMau\.docker\machine\machines\worker3\fixed.vhd
(worker3) DBG | VhdFormat               : VHD
(worker3) DBG | VhdType                 : Fixed
(worker3) DBG | FileSize                : 10486272
(worker3) DBG | Size                    : 10485760
(worker3) DBG | MinimumSize             :
(worker3) DBG | LogicalSectorSize       : 512
(worker3) DBG | PhysicalSectorSize      : 512
(worker3) DBG | BlockSize               : 0
(worker3) DBG | ParentPath              :
(worker3) DBG | DiskIdentifier          : 54A43223-9A0E-4E76-B3AF-15AC85F64942
(worker3) DBG | FragmentationPercentage : 0
(worker3) DBG | Alignment               : 1
(worker3) DBG | Attached                : False
(worker3) DBG | DiskNumber              :
(worker3) DBG | IsPMEMCompatible        : False
(worker3) DBG | AddressAbstractionType  : None
(worker3) DBG | Number                  :
(worker3) DBG |
(worker3) DBG |
(worker3) DBG |
(worker3) DBG |
(worker3) DBG | [stderr =====>] :
(worker3) DBG | Writing magic tar header
(worker3) DBG | Writing SSH key tar header
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Convert-VHD -Path 'C:\Users\McMau\.docker\machine\machines\worker3\fixed.vhd' -DestinationPath 'C:\Users\McMau\.docker\machine\machines\worker3\disk.vhd' -VHDType Dynamic -DeleteSource
(worker3) DBG | [stdout =====>] :
(worker3) DBG | [stderr =====>] :
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Resize-VHD -Path 'C:\Users\McMau\.docker\machine\machines\worker3\disk.vhd' -SizeBytes 20000MB
(worker3) DBG | [stdout =====>] :
(worker3) DBG | [stderr =====>] :
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive New-VM worker3 -Path 'C:\Users\McMau\.docker\machine\machines\worker3' -SwitchName 'BridgedSwitch' -MemoryStartupBytes 1024MB
(worker3) DBG | [stdout =====>] :
(worker3) DBG | Name    State CPUUsage(%) MemoryAssigned(M) Uptime   Status             Version
(worker3) DBG | ----    ----- ----------- ----------------- ------   ------             -------
(worker3) DBG | worker3 Off   0           0                 00:00:00 Operating normally 8.2
(worker3) DBG |
(worker3) DBG |
(worker3) DBG |
(worker3) DBG | [stderr =====>] :
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Set-VMDvdDrive -VMName worker3 -Path 'C:\Users\McMau\.docker\machine\machines\worker3\boot2docker.iso'
(worker3) DBG | [stdout =====>] :
(worker3) DBG | [stderr =====>] :
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Add-VMHardDiskDrive -VMName worker3 -Path 'C:\Users\McMau\.docker\machine\machines\worker3\disk.vhd'
(worker3) DBG | [stdout =====>] :
(worker3) Starting VM...
(worker3) DBG | [stderr =====>] :
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Start-VM worker3
(worker3) DBG | [stdout =====>] :
(worker3) DBG | [stderr =====>] :
(worker3) Waiting for host to start...
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM worker3 ).state
(worker3) DBG | [stdout =====>] : Running
(worker3) DBG |
(worker3) DBG | [stderr =====>] :
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM worker3 ).networkadapters[0]).ipaddresses[0]
(worker3) DBG | [stdout =====>] :
(worker3) DBG | [stderr =====>] :
(worker3) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM worker3 ).state
(worker3) DBG | [stdout =====>] : Running
(worker3) DBG |

@knilecrack
What does sandbox in Virtual-V manager shows? Make & share screenshot please.
Seems like vm can't connect to the network cause have no ip assigned or vm just doesn't start properly.

Did you mean this ? https://1drv.ms/u/s!AtmVXevYpYur6j6WHvexC6ShiqkO
So basically I got it to work now, after windows updated to 17063 I completely uninstalled docker everything that I could find (from programdata and from appdata) and reinstalled hyperv using dism.
Only problem now is that it needs like 5-10 minutes to get an IP.
Is there anyway to troubleshoot these connection problems more deeply?

Is there anyway to troubleshoot these connection problems more deeply?

Don't know really. ¯_(ツ)_/¯

I'll close the issue until the problem arises again.

Hi everybody and happy new year.
I am beginner in Docker and I have same problem that you.
I would like to follow the official tutorial of Docker Get Started, Part 4: Swarms

I followed correctly instructions of this page Microsoft Hyper-V
But my PowerShell stay blocked on Waiting for host to start...
docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1

image
_Sorry, it's in french_

image

My setup

Windows:
Windows 10 PRO
Version: 1709
OS: 16299.125 

Client:
 Version:      17.09.1-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   19e2cf6
 Built:        Thu Dec  7 22:22:26 2017
 OS/Arch:      windows/amd64

Server:
 Version:      17.09.1-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   19e2cf6
 Built:        Thu Dec  7 22:28:28 2017
 OS/Arch:      linux/amd64
 Experimental: true

docker-machine.exe version 0.13.0, build 9ba6da9

What can I do to resolve this problem ?
Thanks and happy new year again.

@rifton007
Does the problem still persist?
It seems like that the VM started properly but haven't connected to the network.

start with --debug option and paste output.

hey, if you still have issue, try setting IP address manually in VM. 1st get subnet of the switch by right-clicking on adapter that you are trying to use for VM, choose status and then details and you will see a network and subnet of the switch. Then you can try to assign an IP from that subnet on the machine.

Connect to a VM from hyperv, and then just type: ifconfig eth0 172.27.240.10 netmask 255.255.240.0 (in my case)

let me know if that worked for you, you can check by docker-machine ls

I also encountered this issue, and fixed it, I think the root cause is: the document is unclear.
to solve this:
Please make sure you have selected the correct network
There are several networks in the list, but probably there is only one is enabled
You may check the status in: Control Panel\Network and Internet\Network Connections
You may also get here through: Network and Sharing Center/Change adapter settings

See following picture for detailed explanation:
image

@timothy2005 Thanks for you efforts. 👍 Added link to your solution to the top.

@hinell Thanks a lot!

I am facing the same problem as @rifton007 https://github.com/docker/machine/issues/4328#issuecomment-354620409

SOLVED BY @timothy2005's https://github.com/docker/machine/issues/4328#issuecomment-402993480. Thanks..

I also encountered this issue, and fixed it, I think the root cause is: the document is unclear.
to solve this:
Please make sure you have selected the correct network
There are several networks in the list, but probably there is only one is enabled
You may check the status in: Control Panel\Network and Internet\Network Connections
You may also get here through: Network and Sharing Center/Change adapter settings

See following picture for detailed explanation:
image

It worked for me! tks

I faced the same issue. retried from powershell window in admin mode, first vm took around 10 minutes while appeared to be stuck at Starting Vm step but eventually completed the task. second vm was created much faster.

solve this by NOT add -hyperv-memory!At fitst i set this to 512, but when i remove this, it works.

my way out, thanks @moviewang

Was this page helpful?
0 / 5 - 0 ratings