我在练习中练习码头工人。
技术方法是配置jenkins slave,它是docker容器。
以下是jenkins_slave的Dockerfile
FROM ubuntu:latest
ENV DEBIAN_FRONTEND noninteractive
RUN groupadd -g 1000 jenkins_slave
RUN useradd -d /home/jenkins_slave -s /bin/bash \
-m jenkins_slave -u 1000 -g jenkins_slave
RUN echo jenkins_slave:jpass | chpasswd
RUN apt-get update && \
apt-get install -y openssh-server openjdk-8-jre wget iproute2
RUN mkdir -p /var/run/sshd
CMD ip route | grep "default via" \
| awk '{print $3}' && /usr/sbin/sshd -D
我使用命令
建立了docker图像docker build -t jenkins_slave .
然后我使用命令
将docker镜像作为容器运行$ docker run --name jenkins_slave -it -p 2222:22 jenkins_slave
172.17.0.1
然后我使用下面的docker命令运行jenkins服务器
$ docker run --name jenkins_server -p 8080:8080 -p 50000:50000 dockerinpractice/jenkins:server
以下是节点配置详细信息 -
然后我收到错误消息“ 此代理处于脱机状态,因为Jenkins未能在其上启动代理进程
以下是错误堆栈跟踪
[12/07/17 08:50:00] [SSH] Opening SSH connection to 172.17.0.1:2222.
/var/jenkins_home/.ssh/known_hosts [SSH] No Known Hosts file was found at
/var/jenkins_home/.ssh/known_hosts. Please ensure one is created at this path and that Jenkins can read it.
Key exchange was not finished, connection is closed.
java.io.IOException: There was a problem while connecting to 172.17.0.1:2222
at com.trilead.ssh2.Connection.connect(Connection.java:834)
at com.trilead.ssh2.Connection.connect(Connection.java:703)
at com.trilead.ssh2.Connection.connect(Connection.java:617)
at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:1284)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:804)
at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:793)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Key exchange was not finished, connection is closed.
at com.trilead.ssh2.transport.KexManager.getOrWaitForConnectionInfo(KexManager.java:95)
at com.trilead.ssh2.transport.TransportManager.getConnectionInfo(TransportManager.java:237)
at com.trilead.ssh2.Connection.connect(Connection.java:786)
... 9 more
Caused by: java.io.IOException: The server hostkey was not accepted by the verifier callback
at com.trilead.ssh2.transport.KexManager.handleMessage(KexManager.java:548)
at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:790)
at com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:502)
... 1 more
我有一个名为test的简单构建配置,但由于从属设备处于脱机状态,因此构建未运行。
知道为什么jenkins master没有识别从服务器。
答案 0 :(得分:2)
只需在节点配置中将Host Key verification strategy
更改为Non verfiying Verification Strategy
。
答案 1 :(得分:1)
您正在使用Host Key verification strategy
方法检查known_hosts
文件(通常位于~/.ssh/known_hosts
)。但是,jenkins服务器正在检查docker容器中的/var/jenkins_home/.ssh/known_hosts
,现在可能为空。
您可以使用Manually provided key Verification Strategy
并在其中粘贴公钥,或者在this document的帮助下使用其他方法。