Directly inspired from jenkinsci/ssh-slave and jenkins/ssh-slave
How to use this image with Docker Plugin
I used this image as FROM for my Jenkins Docker slaves
Compare to ssh-slave this image have some important differences :
- this version is based on Alpine instead Debian (~311Mo vs ~658Mo)
- it's a Docker In Docker version (you can use Docker inside) based on official Docker 17.11 DinD image
- Pre-installed : git, subversion, curl, wget
Available on Docker Hub wedroid/jenkins-dind-ssh-slave
To use this image with Jenkins just follow Launch via SSH paragraph in this page (Docker Plugin) and use wedroid/jenkins-dind-ssh-slave instead jenkins/ssh-slave
-
This image is made to only works with Jenkins ssh user (Jenkins user have right to use Docker without sudo)
- To run Docker in Docker, the parent container needs to be run with privileged. (option available in
Container settings…
menu)
-
In Jenkins, create an item and choose Freestyle project,
-
Fill
Restrict where this project can be run
field with the label set in plugin configuration -
Add a build step, select
Execute shell
and fill field with /usr/local/bin/docker --version -
Save and execute your build
-
After execution, check the console log and search some thing like this
+ /usr/local/bin/docker --version Docker version 17.10.0-ce, build f4ffd25