Open devshorts opened 8 years ago
@devshorts It appears that docker-machine
has a bug with spaces in file paths. It's trying to invoke the SSH executable, but it's failing to resolve the full file path under c:\Program Files
, instead truncating it to c:\Program
. This is actually a common problem with software that isn't tested with spaces in filesystem paths. I'd suggest updating the title of your issue report to help gain visibility to this.
Cheers, Trevor Sullivan Microsoft MVP: PowerShell
This is caused by Gow. Gow has a ssh
command which is an alias to plink
. It looks like when ran from Windows CMD, docker-machine
uses whatever is in the path for ssh
and cannot work with plink as a ssh replacement.
I get the same error as the OP when I run docker-machine
with Gow in my PATH
. Here's my output from Windows CMD:
>docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
docker * virtualbox Running Unknown Something went wrong running an SSH command!
command : ip addr show dev eth1
err : exit status 1
output : 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
From Git Bash, I get no error whatsoever:
MINGW64 ~
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
docker - virtualbox Running tcp://192.168.99.100:2376 v1.10.3
If I take Gow out from my PATH
(so no ssh
command in my path), I get no error in Windows CMD.
The ssh
command from Gow looks like this:
"C:\Program Files (x86)\Gow\bin\ssh.bat"
@echo off
plink %1 %2 %3 %4 %5 %6 %7 %8 %9
+1. I created docker-cmd-js, which should help running docker commands on Windows. Most common usage I can see would be using it in gulp. See blog about it if interested. Everything works fine until I execute gulp
in a command line with Administrator mode.
This appears to be a bug in golang's native exec.Command
function, as per this issue.
The offending code is in the getSSHCmd function, currently at line 376 of:
machine/libmachine/ssh/client.go
Problem: I'm not currently familiar enough with the Go language to propose any kind of Pull Request, but I'm sure there's something simple that can be done to resolve this.
Of course, the work-around is to use some kind of mingw bash shell to run docker-machine, but because it already detects the OS as Windows, you have to remember to add the --shell bash
argument to commands like docker env
. Otherwise you get commands written for cmd.exe, rather than bash or Powershell.
I can confirm that this problem still exists.
My setup:
Ubuntu 16.04 Server LTS
docker-machine version 0.15.0 build b48dc28d
PowerShell Core 6.1.0-preview.2
Calling docker-machine
or ssh
from PowerShell scripts, causes timeouts and "hidden" interactive ssh sessions, etc. However, interactive ssh sessions do work when calling ssh
directly from a PowerShell prompt (pwsh
).
Perhaps the problem is related to these issues:
The way that I resolve most of my SSH-related issues, is by letting PowerShell start a bash
process that in turn executes the relevant docker-machine
command.
Note I am using Windows 10 Pro with Hyper-V and docker for windows. Not docker toolbox and virtualbox.
Now docker-machine runs in the powershell and git bash. The problem might be because.
I did a fresh install of the docker toolbox on a new windows box today. I can run docker fine in the docker quickstart
But in powershell
When trying to set env
Seems like something may be wrong with ssh?
I'm not sure. Any help would be appreciated
-- EDIT
I switched my ssh to be git ssh but still no dice
-- EDIT
turns it this is somehow related to running powershell in admin mode. After changing the ssh env var path I can run docker-machine fine in not powershell admin mode.