docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.63k stars 1.97k forks source link

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

Open JustinJKlein opened 7 years ago

JustinJKlein commented 7 years ago

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

LiamMartens commented 7 years ago

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

vvucetic commented 7 years ago

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).

msvaillant commented 7 years ago

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

embray commented 7 years ago

@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.

lussong commented 7 years ago

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.

indranil-chakraborty-sp commented 7 years ago

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.

javacraft commented 7 years ago

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.

BretFisher commented 7 years ago

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>

dhan2vijay commented 6 years ago

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

indranil-chakraborty commented 6 years ago

@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?

BlitzkriegSoftware commented 6 years ago

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

dhan2vijay commented 6 years ago

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

igostv commented 6 years ago

@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

BlitzkriegSoftware commented 6 years ago

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?

igostv commented 6 years ago

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 commented 6 years ago

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

ohdihe commented 6 years ago

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

fabricek commented 6 years ago

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.

ApoTheOne commented 6 years ago

Restarting docker or creating new switch works for me.

timothy2005 commented 6 years ago

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

ghost commented 6 years ago

Excellent contribution @timothy2005 I've been struggling with this and the graphic really pointed me in the right direction. I've tried various things, I couldn't get it to use the main ethernet connection (red cross) but as soon as I got my Wifi adapter working properly (and disabled VirtualBox adapters along the way) problem solved.

igostv commented 5 years ago

It works with internal virtual switch if NAT configured, because NAT gives IP to boot2docker over dhcp. After windows 10 Fall Creaters update 1709 there is a "Default switch" and it is NAT configured. I've used it because I've no success to configure NAT with new one. P.S. If a windows native openssh-client (that is external for docker) enabled on your system, you should use --native-ssh argument with docker-machine.exe, because of TLS error.

vardhmanandroid2015 commented 5 years ago

Make sure to use external network in creating virtual switch with enable ethernet otherwise it will remain in Waiting for host to start..... Once that works then you need to open firewall to connect through.....

LostNomad311 commented 5 years ago

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

this worked for me , thanks @timothy2005