Jenkins SSH slave Docker image
A Jenkins slave using SSH to establish connection.
See Jenkins Distributed builds for more info.
To run a Docker container
docker run jenkinsci/ssh-slave "<public key>"
You'll then be able to connect this slave using ssh-slaves-plugin as "jenkins" with the matching private key.
How to use this image with Docker Plugin
To use this image with Docker Plugin, you need to
pass the public SSH key using environment variable
JENKINS_SLAVE_SSH_PUBKEY and not as a startup argument.
In Environment field of the Docker Template (advanced section), just add:
JENKINS_SLAVE_SSH_PUBKEY=<YOUR PUBLIC SSH KEY HERE>
Don't put quotes around the public key. You should be all set.
I've just tried to use this, it turns out you have to pass the whole pubkey (as a string). There is a comment in the script inside the container, which says:
docker run jenkinsci/ssh-slave <public key>
docker run -e "JENKINS_SLAVE_SSH_PUBKEY=<public key>" jenkinsci/ssh-slave
Thank you for your share,but I am confused about the <public key> .
When I tried to input the public key String, there was error "can't find file/directory", should it be the path of the id_rsa file?
And it 's possible to run without the public key param.
So would you please give more detail of the param? Thank you so much