Jenkins 无法使用 docker 插件启动 docker slave
Jenkins cannot launch docker slave using docker plugin
我正在使用 Jenkins Docker 插件在 docker 主机上动态启动从站。 Jenkins master 在同一台主机上运行。构建时,它会在 docker-host 上选择一个随机端口并且无法连接到它。它启动 docker 个容器。这是日志。不多说了。如何调试问题?
INFO: Started container ID 54fe5780ca820a6e2b7cae40610cfc3229dbf889b0c66d6e34a39b74e13aaec7 for node slave-0000w16w841rc from image: jenkinsubuntu
Feb 28, 2019 9:35:54 PM com.nirima.jenkins.plugins.docker.utils.PortUtils$ConnectionCheckSSH execute
INFO: SSH port is open on 127.0.0.1:10007
[02/28/19 21:35:54] SSH Launch of slave-0000w16w841rc on 127.0.0.1 failed in 29 ms
Feb 28, 2019 9:36:03 PM hudson.slaves.NodeProvisioner run
INFO: Image of jenkinsubuntu provisioning successfully completed. We have now 7 computer(s) `
没有找到答案。但最终在 docker 插件的 Docker 模板中选择了 attach docker container
的连接方法,这反过来又使其工作。
虽然您已经发布了另一种方法,但是在您询问如何调试问题时,您应该做什么以及注意什么
- 您需要包含
SSHD
和 plugin's documentation advises to use jenkins/ssh-slave 的图像作为自定义图像的基础。
- 根据您提供的日志,您似乎使用了名为
jenkinsubuntu
的自定义图像,假设该图像基于 jenkins/ssh-slave then you need to make sure that you didn't override the original entrypoint as described in the documentation:
Avoid overriding the docker command, as SSH Launcher relies on it.
You can use an Entrypoint to run some side service inside your build agent container before the agent runtime starts and establish a connexion. Just ensure your entrypoint eventually run the passed command :
exec "$@"
最后确保将进行 ssh 的主机包含一个私钥,该私钥与注入容器内的 public 密钥相匹配。
如果解决了第一点和第二点,那么您应该如何调试 ssh 问题。
- 您可以登录尝试使用 ssh 登录同一个容器,同时 运行。
- 如果前面的步骤有效,则使用
docker logs
或检查 /var/log
检查日志,请注意,您可能需要将 /etc/ssh/sshd_config
下的 LogLevel
更改为VERBOSE
将 ssh 登录尝试的所有详细信息保存在 /var/log/auth.log
文件中,您可以在其中识别问题
我正在使用 Jenkins Docker 插件在 docker 主机上动态启动从站。 Jenkins master 在同一台主机上运行。构建时,它会在 docker-host 上选择一个随机端口并且无法连接到它。它启动 docker 个容器。这是日志。不多说了。如何调试问题?
INFO: Started container ID 54fe5780ca820a6e2b7cae40610cfc3229dbf889b0c66d6e34a39b74e13aaec7 for node slave-0000w16w841rc from image: jenkinsubuntu
Feb 28, 2019 9:35:54 PM com.nirima.jenkins.plugins.docker.utils.PortUtils$ConnectionCheckSSH execute
INFO: SSH port is open on 127.0.0.1:10007
[02/28/19 21:35:54] SSH Launch of slave-0000w16w841rc on 127.0.0.1 failed in 29 ms
Feb 28, 2019 9:36:03 PM hudson.slaves.NodeProvisioner run
INFO: Image of jenkinsubuntu provisioning successfully completed. We have now 7 computer(s) `
没有找到答案。但最终在 docker 插件的 Docker 模板中选择了 attach docker container
的连接方法,这反过来又使其工作。
虽然您已经发布了另一种方法,但是在您询问如何调试问题时,您应该做什么以及注意什么
- 您需要包含
SSHD
和 plugin's documentation advises to use jenkins/ssh-slave 的图像作为自定义图像的基础。 - 根据您提供的日志,您似乎使用了名为
jenkinsubuntu
的自定义图像,假设该图像基于 jenkins/ssh-slave then you need to make sure that you didn't override the original entrypoint as described in the documentation:Avoid overriding the docker command, as SSH Launcher relies on it.
You can use an Entrypoint to run some side service inside your build agent container before the agent runtime starts and establish a connexion. Just ensure your entrypoint eventually run the passed command :
exec "$@"
最后确保将进行 ssh 的主机包含一个私钥,该私钥与注入容器内的 public 密钥相匹配。
如果解决了第一点和第二点,那么您应该如何调试 ssh 问题。
- 您可以登录尝试使用 ssh 登录同一个容器,同时 运行。
- 如果前面的步骤有效,则使用
docker logs
或检查/var/log
检查日志,请注意,您可能需要将/etc/ssh/sshd_config
下的LogLevel
更改为VERBOSE
将 ssh 登录尝试的所有详细信息保存在/var/log/auth.log
文件中,您可以在其中识别问题