Reputation: 722
I am using Jenkins Docker plugin to launch slaves dynamically on the docker host. Jenkins master runs on the same host. When building, it picks a random port on the docker-host and cannot connect to it. It launches docker containers. Here are the logs. Doesn't say more than this. How to debug the issue?
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$2 run
INFO: Image of jenkinsubuntu provisioning successfully completed. We have now 7 computer(s) `
Upvotes: 4
Views: 1808
Reputation: 11970
Although you have posted an alternative way but here what you should do and be aware about as you asked about how to debug the issue
SSHD
and the plugin's documentation advises to use jenkins/ssh-slave as a base for your custom image.jenkinsubuntu
assuming that image based on 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 "$@"
Lastly make sure that the host where the ssh will takes place contains a private key that matches the public key that was injected inside the container.
If the first and the second point was taken care of then here is what to you should do to debug the ssh problem.
docker logs
or by checking /var/log
, note that you may need to change the LogLevel
under /etc/ssh/sshd_config
to VERBOSE
to make all the details of ssh login attempts saved in /var/log/auth.log
file where you can identify the issueUpvotes: 2
Reputation: 722
Didn't find an answer. But ended-up selecting the connect method to attach docker container
in Docker template for docker plugin which in-turn made it work.
Upvotes: 6