gpt4 book ai didi

docker-machine - 无法使用 docker-machine 添加主机

转载 作者:行者123 更新时间:2023-12-04 04:31:59 27 4
gpt4 key购买 nike

我在公司数据中心的 linux VM 上安装了 docker-engine。我在 Windows 上安装了 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

但是等待几分钟后我收到以下错误
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

我不知道我做错了什么。

最佳答案

尝试使用 native SSH

不幸的是,这可能有多种原因,但既然你说你在 Windows 上运行,我有一个猜测。尝试使用本地 SSH 客户端 - 即 Docker 附带的 Go 库,而不是 ssh.exe .为此,请通过 --native-ssh论据 docker-machine :

docker-machine --native-ssh create --driver generic --generic-ip-address example.com ExampleMachine

检查调试输出

您可以通过传递 --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...>

我的猜测,在尝试通过后 --generic-ssh-key在 Windows 上使用反斜杠并使其产生错误,是因为 Docker(仍然)在 Windows 上没有达到应有的水平,我想知道它调用外部 SSH 客户端的方式是否有问题。由于使用本地 Go SSH 客户端对我有用,我认为我的猜测是正确的,至少对我来说是这样。

关于docker-machine - 无法使用 docker-machine 添加主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35598922/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com