machine icon indicating copy to clipboard operation
machine copied to clipboard

Getting Docker-Machine Running On Windows with Hyper-v Waiting for host to start....

Open JustinJKlein opened this issue 10 years ago • 24 comments

I am having trouble getting my docker-machine to create and run a new box. I have followed the directions on installing docker and manually setting up a switch with hyperv using these docs : https://docs.docker.com/machine/drivers/hyper-v/

C:\WINDOWS\system32>docker-machine create -d hyperv --hyperv-virtual-switch "Virtual Switch Main" manager1 Running pre-create checks... Creating machine... (manager1) Copying C:\Users\Spartan.docker\machine\cache\boot2docker.iso to C:\Users\Spartan.docker\machine\machines\manager1\boot2docker.iso... (manager1) Creating SSH key... (manager1) Creating VM... (manager1) Using switch "Virtual Switch Main" (manager1) Creating VHD (manager1) Starting VM... (manager1) Waiting for host to start...

And it hangs there forever.... :( If any of you have suggestions on how to get it working from here that would be amazing!

When I run docker-machine ls C:\WINDOWS\system32>docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS manager1 * hyperv Running Unknown IP not found tensor * hyperv Running Unknown IP not found

C:\WINDOWS\system32>docker --version Docker version 1.12.1, build 23cf638

C:\WINDOWS\system32>docker-machine --version docker-machine version 0.8.1, build 41b3b25 run as administrator too

JustinJKlein avatar Oct 18 '16 03:10 JustinJKlein

I'm having the exact same issue --'

the machine is running and accessible though when checking it in the hyper v manager, but it appears the docker script is not picking up on that

When enabling debug mode it appears to be stuck on

(default2) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\\powershell.exe -NoProfile -NonInteractive
 ( Get-VM default2 ).state

^^ that command

LiahMartens avatar Nov 07 '16 21:11 LiahMartens

I have the same issue after updating to latest version of Docker Toolbox (Windows).

EDIT: It could be related with that I'm currently using WLAN unlike ethernet before. I will check tomorrow.

EDIT2: Yes. Works fine when connected with ethernet connection (Hyper V external switch).

vvucetic avatar Nov 13 '16 19:11 vvucetic

I have run into the same problem - does anybody have solution for that trouble?

msvaillant avatar Dec 26 '16 18:12 msvaillant

@vvucetic Ditto to that--using th ethernet adapter instead of WLAN for now worked around this for me.

Correction: I got everything working on my WLAN adapter--after a bit more research a few things actually needed to be done. I had to disable IPv6 support on the adapter first (sadly, though I wasn't using it at the moment) and also had to make sure to disable the VirtualBox Bridged Networking driver. Then everything worked, and my VM was assigned an IPv4 address.

embray avatar Jan 17 '17 11:01 embray

I have the same problem and found out I choose a wrong network card creating virtual switch. I am using WLAN, everything works fine after I change external network to Wireless card.

lussong avatar Mar 27 '17 16:03 lussong

Running into this issue while learning docker from the tutorial at https://docs.docker.com/get-started/part4/#create-a-cluster. I had to modify the 'myswitch' device to use Ethernet adapter instead of wifi in order to get it to work.

indranil-chakraborty-sp avatar Apr 25 '17 19:04 indranil-chakraborty-sp

I had the same problem. VMs are created, powered up and running, but docker-machine hangs at Waiting for host to start... for either (second VM was created in another PowerShell, after had hung for 5-minutes). I followed suggestions given by @embray previously with no success. Reviewed dmesg on both VMs and found that they could not find ethernet devices.

It turned out that I had chosen the wrong Ethernet Adapter while creating the virtual switch (Supermicro mobo, with several NICs). Once changed, docker-machine ls was able to list VMs, but complained about TLS certificate only being valid for 127.0.0.1. Given my noob state with Docker, I wasn't sure where certificates were stored, let along be changed. Instead I took the brute-force approach removing and delete both VMs. Once recreated, everything was peachy... so far... on to the get part of the tutorial.

javacraft avatar May 01 '17 08:05 javacraft

This can also happen if you have Docker for Windows installed, which creates the DockerNAT virtual switch in Hyper-V (which is internal only). Then you might use docker-machine to create a VM, which ends up using that virtual switch by default. So to fix, be sure you've created a new switch first, and then use that one when creating docker machines.

docker-machine create -d hyperv --hyperv-virtual-switch "<NameOfVirtualSwitch>" <nameOfNode>

BretFisher avatar May 04 '17 18:05 BretFisher

C:\Users\Admin.WSD027>docker-machine create --driver hyperv vm Running pre-create checks... Creating machine... (vm) Copying C:\Users\Admin.WSD027.docker\machine\cache\boot2docker.iso to C:\Users\Admin.WSD027.docker\machine\machines\vm\boot2docker.iso... (vm) Creating SSH key... (vm) Creating VM... (vm) Using switch "Layered_Ethernet" (vm) Creating VHD (vm) Starting VM... (vm) Waiting for host to start... Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available... it hangs der can one help me out

dhan2vijay avatar Oct 04 '17 06:10 dhan2vijay

@dhan2vijay Can you see the instance being spun up in Hyper-V? If so, can you then SSH to it using a client such as PuTTY?

indranil-chakraborty avatar Oct 04 '17 15:10 indranil-chakraborty

This happens to me too. It hangs on "Waiting for host to start", is there a log file or something?

BlitzkriegSoftware avatar Oct 08 '17 20:10 BlitzkriegSoftware

@indranil-chakraborty yes i checked that but i cant access that

dhan2vijay avatar Oct 13 '17 05:10 dhan2vijay

@dhan2vijay, you can access it by Hyper-v Manager. Also you can try to create a new virtual switch, and use it instead of default DockerNAT. It helped me

igostv avatar Oct 13 '17 16:10 igostv

I did create a special switch just for that. What procedure did you use through hyper-v manager? Do you mean spinning up the console on the VM from there?

BlitzkriegSoftware avatar Oct 13 '17 16:10 BlitzkriegSoftware

Yes, you can connect to VM in hyper-v manager, double click VM in VM list. https://technet.microsoft.com/en-us/library/cc742407(v=ws.11).aspx It's like a real display connected to VM You can check network settings in a created VM, checkout dmesg and other logs in VM, and find out, why it is not accessible by ssh

igostv avatar Oct 14 '17 22:10 igostv

Make sure vmswitch is external https://docs.docker.com/machine/drivers/hyper-v/

igostv avatar Oct 15 '17 09:10 igostv

I had same issue but resolved by selecting "Intel(R) Ethernet Connection" from the drop down menu of the External network. Follow the instructions here https://docs.docker.com/machine/drivers/hyper-v/#2-set-up-a-new-external-network-switch-optional

But make sure you select the Ethernet Connection option from the drop down menu of the External network

ohdihe avatar Feb 08 '18 16:02 ohdihe

Go to "network and sharing center"->"change adapter settings" and select the "Network bridge"adapter created by Hyper-v when setting the external network switch. Set "Internet Protocol Version (TCP/IPv4)" under "Network bridge" properties. Mine was unset. That's all.

fabricek avatar Feb 25 '18 15:02 fabricek

Restarting docker or creating new switch works for me.

ApoTheOne avatar Apr 17 '18 02:04 ApoTheOne

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 avatar Jul 06 '18 10:07 timothy2005