从Jenkins Docker容器连接到localhost从节点

时间:2018-09-23 21:35:39

标签: docker jenkins

我确实想将Docker容器中的 Jenkins主从服务器连接到我的 localhost计算机节点从服务器(准确地说是macOS High Sierra)。 这是我遵循的步骤:

  1. 运行SSHLauncher{host='192.168.1.33', port=22, credentialsId='4bc9a817-edae-4806-bc55-2f5b4f5b03e7', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=210, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true} [09/23/18 21:24:39] [SSH] Opening SSH connection to 192.168.1.33:22. Connection refused (Connection refused) SSH Connection failed with IOException: "Connection refused (Connection refused)", retrying in 15 seconds. There are 10 more retries left. Connection refused (Connection refused) SSH Connection failed with IOException: "Connection refused (Connection refused)", retrying in 15 seconds. There are 8 more retries left. Connection refused (Connection refused) SSH Connection failed with IOException: "Connection refused (Connection refused)", retrying in 15 seconds. There are 9 more retries left. Connection refused (Connection refused) SSH Connection failed with IOException: "Connection refused (Connection refused)", retrying in 15 seconds. There are 7 more retries left.
  2. 转到管理詹金斯。点击管理节点
  3. 启动方法,选择:通过SSH在Unix机器上启动从属代理
  4. 主机:192.168.1.33、127.0.0.1,localhost,0.0.0.0
  5. 凭据:用户名和密码或具有私有密钥的 SSH用户名

我不知道应该在“主机”字段中输入什么IP,在“凭据”字段中选择哪个选项。我已经尝试了几种组合,但没有得到任何结果。另外,当我从容器向本地主机执行ping操作时,它总是成功的。

如何设置“主机”和“凭据”字段以连接到本地主机节点从属服务器,而不必使用通过Java Web Start启动从属代理程序 我总是会收到此错误:

{{1}}

2 个答案:

答案 0 :(得分:0)

您的从属节点是否在端口22上侦听SSH连接?

  • 如果是,您是否可以从Jenkins主服务器telnet 192.168.1.33 22?

  • 如果否,请在您的从属节点上安装基本的SSH服务器,例如open openssh并再试一次?

答案 1 :(得分:0)

我刚刚使用Mac作为从节点,使用Jenkins Docker容器进行此工作。

在“主机”字段中输入在终端上运行时“主机名”命令的输出。要设置凭据字段,请使用Mac的用户名和密码创建一个Jenkins凭据(无论在终端上运行ssh localhost时,什么凭据都有效)。

我还将“主机密钥验证策略”字段设置为“非验证验证策略”。但是,如果您在终端上手动运行ssh命令并接受密钥,则可能不需要此

相关问题