无法使用docker-machine添加主机

Gou*_*gla 5 docker-machine

我在公司数据中心的Linux VM上安装了docker-engine.我在我的窗户上安装了docker-machine.我想通过我的Windows机器来管理这个docker-engine.我想添加这个主机,为此我执行了以下命令:

docker-machine create -d generic --generic-ip-address 10.51.227.5 --generic-ssh-port 22 --generic-ssh-user root compute
Run Code Online (Sandbox Code Playgroud)

但是等了几分钟后我收到了以下错误

Running pre-create checks...
Creating machine...
(compute) No SSH key specified. Connecting to this machine now and in the future will require the ssh agent to contain the appropriate key.
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Error creating machine: Error detecting OS: Too many retries waiting for SSH to be available.  Last error: Maximum number of retries (60) exceeded
Run Code Online (Sandbox Code Playgroud)

我不知道我做错了什么.

Mic*_*ter 1

尝试使用本机 SSH

不幸的是,发生这种情况的原因有多种,但既然你说你在 Windows 上运行,我有一个猜测。尝试使用本机 SSH 客户端 - 即 Docker 附带的 Go 库,而不是ssh.exe. 为此,请将--native-ssh参数传递给docker-machine

docker-machine --native-ssh create --driver generic --generic-ip-address example.com ExampleMachine
Run Code Online (Sandbox Code Playgroud)

检查调试输出

您可以通过传递参数来检查各种调试消息--debug。当我这样做并且没有指定--native-ssh参数时,我收到了很多错误消息:

> docker-machine create --driver generic --generic-ip-address example.com ExampleMachine
<...snip...>
Waiting for SSH to be available...
Getting to WaitForSSH function...
(apsylania) Calling .GetSSHHostname
(apsylania) Calling .GetSSHPort
(apsylania) Calling .GetSSHKeyPath
(apsylania) Calling .GetSSHKeyPath
(apsylania) 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 root@example.com -o IdentitiesOnly=yes -i C:\Users\MyAccount\.docker\machine\machines\ExampleMachine\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' : ssh command error:
command : exit 0
err     : exit status 255
output  :
Getting to WaitForSSH function...
<...snip...>
Run Code Online (Sandbox Code Playgroud)

我的猜测是,在尝试--generic-ssh-key在 Windows 上使用反斜杠传递并让它产生错误之后,Docker(仍然)在 Windows 上还没有达到应有的程度,我想知道它的调用方式是否存在问题输出到外部 SSH 客户端。由于使用本机 Go SSH 客户端对我有用,所以我认为我的猜测是正确的,至少对于我的情况来说是这样。