Docker-machine fails to crate SSH connection to new VM

The symptoms are the same as in issue (Docker machine stuck on “Waiting for ssh to be available...”) that is, the “docker-machine create …” command gets stuck trying to create an SSH connection to a newly created Hyper-V docker-host VM. However the root cause seem different.

I am running:

  • Windows 10 Pro
  • docker version 17.03.1-ce, build c6d412e
  • docker-machine version 0.10.0, build 76ed2a6

The docker-machine command is:
docker-machine -debug create -d hyperv --hyperv-virtual-switch ExternalWireless worker1

The relevant section of the terminal output is:

Getting to WaitForSSH function…
(worker1) Calling .GetSSHHostname
(worker1) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM worker1 ).state
(worker1) DBG | [stdout =====>] : Running
(worker1) DBG |
(worker1) DBG | [stderr =====>] :
(worker1) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM worker1
).networkadapters[0]).ipaddresses[0]
(worker1) DBG | [stdout =====>] : 192.168.0.106
(worker1) DBG |
(worker1) DBG | [stderr =====>] :
(worker1) Calling .GetSSHPort
(worker1) Calling .GetSSHKeyPath
(worker1) Calling .GetSSHKeyPath
(worker1) Calling .GetSSHUsername
***Using SSH client type: external
&{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o
ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker@192.168.0.106 -o IdentitiesOnly=yes -i C:\Users\wojtek.docker\machine\machines\worker1\id_rsa -p
22] C:\Program Files\OpenSSH\ssh.exe }
About to run SSH command:
exit 0
SSH cmd err, output: exit status 255:
Error getting ssh command ‘exit 0’ : ssh command error:
command : exit 0
err : exit status 255

"docker-machine ls" command returns the following:
worker1 - hyperv Running tcp://192.168.0.106:2376 Unknown Unable to query docker version: Get https://192.168.0.106:2376/v1.15/version: x509: certificate signed by unknown authority

The worker1 VM is created, and I can ping it and connect to it from the Hyper-M manager. I can create an SSH session from that VM to the host machine or any other machine running an SSH service. I can also create an SSH connection into that VM machine with the following SSH command:

ssh -v docker@192.168.0.106 -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none -o IdentitiesOnly=yes -i C:\Users\wojtek.docker\machine\machines\worker1\id_rsa

The differences between the above SSH command and the one in the docker-machine script are (1) I have removed the -F option and (2) I added explicit -v parameter name in front of the target user.

Can someone please help debug the issue and/or explain why the “docker-machine create” and “docker-machine ls” commands fail?

Cheers, Wojtek

1 Like

Do the commands work now ?

No they don’t, but we now know what is going on. For details see the issue I have filed in the Win32-OpenSSH GitHub repo @ https://github.com/PowerShell/Win32-OpenSSH/issues/666. It looks like the fix may be already available, but I have not tested it yet.

Wojtek

1 Like