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

Windows 10, Hyper-V docker-machine uses /dev/null for -F parameter in ssh command #3648

Open tnymlr opened 8 years ago

tnymlr commented 8 years ago

Unable to create new machine. Actually unable to do anything involving ssh with machine, because docker-machine uses /dev/null file for -F parameter of ssh command.

Getting to WaitForSSH function...
(default) Calling .GetSSHHostname
(default) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\\powershell.exe -NoProfile -NonInteractive ( Get-VM default ).state
(default) DBG | [stdout =====>] : Running
(default) DBG |
(default) DBG | [stderr =====>] :
(default) DBG | [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\\powershell.exe -NoProfile -NonInteractive (( Get-VM default ).networkadapters[0]).ipaddresses[0]
(default) DBG | [stdout =====>] : fe80::215:5dff:fe01:21b
(default) DBG |
(default) Calling .GetSSHPort
(default) Calling .GetSSHKeyPath
(default) Calling .GetSSHKeyPath
(default) DBG | [stderr =====>] :
(default) 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@fe80::215:5dff:fe01:21b -o IdentitiesOnly=yes -i D:\Docker\machines\default\id_rsa -p 22] C:\Program Files\OpenSSH-Win64\ssh.exe <nil>}
About to run SSH command:
exit 0
SSH cmd err, output: exit status 255:
Error getting ssh command 'exit 0' : Something went wrong running an SSH command!
~ > docker -v
Docker version 1.12.0, build 8eab29e
~ > docker-machine -v
docker-machine.exe version 0.8.0, build b85aac1
nathanleclaire commented 8 years ago

because docker-machine uses /dev/null file for -F parameter of ssh command.

You sure this is the exact reason? It might be failing for a different one, this just says "don't use any local SSH configuration file". Granted it could be pathing, /dev/null is very UNIXey.

tnymlr commented 8 years ago

@nathanleclaire It seems that it is the reason. I tried to run it from Git bash - it works (it does some magic with /dev/null afaik). I've also tried to create file C:\dev\null and a script to empty it each time ssh runs and it started to work too. I will try to use different version of ssh though, to see if it could be ssh implementation bug.

nathanleclaire commented 8 years ago

@dikeer maybe we could write a little nullFile() function which will return the correct thing based on OS. seems on Windows it should be NUL, http://stackoverflow.com/questions/313111/dev-null-in-windows, hopefully that'd play OK with git bash.

StefanScherer commented 7 years ago

The build-in ssh works. So is there need to use the external ssh.exe on Windows? I guess it strongly depends on the ssh.exe in PATH and not which shell someone runs docker-machine.exe in. Is there a way to ignore the external ssh.exe without changing PATH?

PS C:\Users\vagrant> docker-machine -D ssh default
Docker Machine Version:  0.8.2, build e18a919
Found binary path at C:\ProgramData\chocolatey\lib\docker-machine\bin\docker-machine.exe
Launching plugin server for driver hyperv
Plugin server listening at address 127.0.0.1:49927
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(default) Calling .GetState
(default) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM default ).state
(default) DBG | [stdout =====>] : Running
(default) DBG |
(default) DBG | [stderr =====>] :
(default) Calling .GetSSHHostname
(default) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Get-VM default ).state
(default) DBG | [stdout =====>] : Running
(default) DBG |
(default) DBG | [stderr =====>] :
(default) DBG | [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Get-VM default ).networkadapters[0]).ipaddresses[0]
(default) DBG | [stdout =====>] : 192.168.254.134
(default) DBG |
(default) DBG | [stderr =====>] :
(default) Calling .GetSSHPort
(default) Calling .GetSSHKeyPath
(default) Calling .GetSSHKeyPath
(default) Calling .GetSSHUsername
SSH binary not found, using native Go implementation
&{{{<nil> 0 [] [] []} docker [0xc2bd70] <nil>  []} 192.168.254.134 22 <nil>}
                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.12.3, build HEAD : 7fc7575 - Thu Oct 27 17:23:17 UTC 2016
Docker version 1.12.3, build 6b644ec
docker@default:~$ ls
log.log
docker@default:~$ exit
Making call to close driver server
(default) Calling .Close
Successfully made call to close driver server
Making call to close connection to plugin binary
(default) DBG | Closing plugin on server side
tiibun commented 7 years ago

@StefanScherer "--native-ssh" option will solve it. https://docs.docker.com/machine/reference/ssh/#/different-types-of-ssh