Docker machine stuck on "Waiting for ssh to be available..."

Installed docker for windows on windows 10 pro. Trying to create a docker machine using the command “docker-machine create --driver hyperv dev”

docker-machine.exe version 0.8.0-rc2, build 4ca1b85

Expected behavior

docker machine is created successfully

Actual behavior

since last 30 minutes the process is stuck at “Waiting for ssh to be available…” message.

Running pre-create checks…
Creating machine…
(devhost) Copying C:\Users\Vishal\.docker\machine\cache\boot2docker.iso to C:\Users\Vishal\.docker\machine\machines\devhost\boot2docker.iso…
(devhost) Creating SSH key…
(devhost) Creating VM…
(devhost) Using switch “DockerNAT”
(devhost) Creating VHD
(devhost) Starting VM…
(devhost) 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…

1 Like

Are you doing this in an Administrator powershell prompt? That’s required for the hyper-v driver to work. I’ve successfully created hyper-v boot2docker machines alongside Docker for Windows.

@friism yes i was running as an administrator. While going through the other questions on the forum i came across your reply Using Docker for Window’s docker-machine create. I created an external switch and it did create the machine successfully. Not sure why doesn’t it work with “DockerNAT” switch.

2 Likes

Hi I have similar problem to @vishalu. I have also installed docker on windows 10 pro (docker version 1.12.3, build 6b644ec).

I’ve already created virtual switch in the same way as it is described in this tutorial https://docs.docker.com/machine/drivers/hyper-v/

and when I try to create vm using following comand:
docker-machine create -d hyperv --hyperv-virtual-switch “Primary Virtual Switch” manager1

it cannot connect to vm via ssh. Any ideas what can I do more?

Waiting for machine to be running, this may take a few minutes…
(manager1) Calling .GetState
(manager1) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM manager1 ).state
(manager1) DBG | [stdout =====>] : Running
(manager1) DBG |
Detecting operating system of created instance…
(manager1) DBG | [stderr =====>] :
Waiting for SSH to be available…
Getting to WaitForSSH function…
(manager1) Calling .GetSSHHostname
(manager1) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM manager1 ).state
(manager1) DBG | [stdout =====>] : Running
(manager1) DBG |
(manager1) DBG | [stderr =====>] :
(manager1) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM manager1 ).networkadapters[0]).ipaddresses[0]
(manager1) DBG | [stdout =====>] : 192.168.90.166
(manager1) DBG |
(manager1) Calling .GetSSHPort
(manager1) DBG | [stderr =====>] :
(manager1) Calling .GetSSHKeyPath
(manager1) Calling .GetSSHKeyPath
(manager1) Calling .GetSSHUsername
SSH binary not found, using native Go implementation
&{{{ 0 [] [] []} docker [0xc2bd70] []} 192.168.90.166 22 }
About to run SSH command:
exit 0
Error dialing TCP: dial tcp 192.168.90.166:22: connectex: Próba połączenia nie powiodła się, ponieważ połączona strona nie odpowiedziała poprawnie po ustalonym okresie czasu lub utworz
one połączenie nie powiodło się, ponieważ połączony host nie odpowiedział.

1 Like

I’ve not found root cause why I cannot connect to my VM via ssh but I’ve found work around. After reading many different posts I’ve started assume that cause can be installed virtualbox. Uninstallation nothing changed, so I decided to recover my windows to the point before Virtualbox has been installed - and it helps. Now everything works great.

1 Like

docker-machine create -d hyperv --hyperv-virtual-switch “” “”

I used the same from Docker: DockerNAT, but change the option "Connection Type"in hyper-v: “External”, take the network adapter your physical computer shows. Perhaps the virtual card provided is missconfigured or your personal antivirus/firewall client avoids properly being connected.

Luck!

It was a firewall issue for me. I disabled the Windows firewall and it started working.

fyi, without digging further into root cause, for me switching ssh implementation worked: changed from openssh to implementation that comes with git. OS: Win 10. docker-machine: 0.10.0. Git 2.12.2.

1 Like

docker-machine --version
docker-machine2.exe version 0.13.0, build 9ba6da9

docker-machine create
ssh key is OpenSSH SSH2 private key (old PEM format)

putty
Unable to use key file “C:\Users\jicky.docker\machine\machines\myvm2\id_rsa” (OpenSSH SSH-2 private key (old PEM format))

ssh -i C:\Users\jicky.docker\machine\machines\myvm1\id_rsa docker@192.168.1.145
key_load_public: invalid format
Unable to negotiate with 192.168.1.145 port 22: no matching host key type found. Their offer: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256

Problem: “Waiting for ssh to be available …” message

A connection between IntelliJ and Boot2Docker is not possible.

In the Windows world, however, there are some peculiarities to consider, which I have not found explicitly described.

Here is my solution:

  1. Install Boot2Docker for Windows -> this is an easy step.
  2. Then install / create a VM (based on boot2docker.iso) with docker-machine create --driver hyperv vm-docker-machine-01
    Of course, HyperV must be activated.
    The installation / process will hang with a “Waiting for ssh to be available …” message.
  3. Uninstall OpenSSH for Windows Beta, otherwise abort the creation of the virtual machine with o.g. Error.
    Settings -> Apps -> optional features
    Then the command docker-machine create --driver hyperv vm-docker-machine-01 runs smoothly
    and a connection between IntelliJ and Boot2Docker can be established.

I had the same issue and I solved it using GIT Bash to run the command to create the virtual machine.

2 Likes

It worked for me as well:
User HyperV
Ran Git-Bash as Administrator
used command docker-machine create -d hyperv --hyperv-virtual-switch “DockerNAT” node1 (in HyperV Manager I set DockerNAT as external network)

Previously I was receiving with PowerShell Waiting for host to start... and on some HyperV configurations was stuck on Waiting for SSH to be available...

Note: Sometimes on Git-Bash it does not create node and stucks, then I reswitch between private and external networks and it unstucks (figures)

1 Like

can i ask how to change ssh implement to git

figure it out. some wifi device seems not so compatible with docker-machine.i change external switch to even iphone enthernet provider and everything works fine.

I changed cmd.exe to git bash and it’i a success,
thanks

I had this issue as well. On Windows 10, I was attempting to create a new Docker machine using the hyperv driver and an external switch. Upon create, the sequence would repeatedly get stuck on “Waiting for ssh to be available…”, on both Powershell and cmd. Took the advice in this thread and ran the exact same commands in Git Bash and everything went though fine!

My question is WHY did Git Bash work while Powershell and cmd both got hung up?

1 Like

Seconded. Running Powershell as admin, disabling firewalls, turning off my VPN, all failed. I was following Docker’s “get started” tutorial, part 3. I created one vm with all off those off using git bash (as Admin), then created another with them all turned back on, just to eliminate that variable.

The relevant variable was the shell: Git bash > Powershell.
For anyone stuck on “waiting for ssh to be available,” this is likely the answer

I found my ultimate solution here, spend a couple of hours on the issue:

It did word for me. The key is the permission of the id_rsa file of the created VM. Good luck!

Or if you want to see the solution in Chinese, it’s here:https://www.jianshu.com/p/eb4641bc5c67

I REALLY want to try out this fix but I just can’t get exactly what he is doing. Which IP address is in that ssh command he is putting on his VM? What is he doing after that on his windows machine with id_rsa permissions? What buttons is he changing? can anyone out there put this together for someone who doesn’t know a lot about it but needs his docker-machine working?