Skip to content

seges/dind-jenkins-slave

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dind-jenkins-slave

Docker-in-Docker Jenkins Slave

Docker Container

Contains:

  • Alpine Linux 3.4
  • Docker 1.11.2-r1
  • Java 8u102b14
  • Compose 1.23.2

Can be used as Jenkins slave that can launch containers with docker.

Requirements

  • Docker installed
  • Jenkins master running inside Docker in same Host as Slaves (Can be scaled with Ambassador pattern to other hosts)
  • Jenkins master with open JNLP port (you may want to fix the port at "Manage Jenkins - Configure Global Security - TCP port for JNLP slave agents")
  • Jenkins master with Swarm Plugin installed

Run Docker-in-Docker Jenkins Slave

To run the Docker-in-Docker Jenkins Slave:

docker run --link=jenkins:master -v /var/run/docker.sock:/var/run/docker.sock -d seges/dind-jenkins-slave:1.3.0

It will:

  • Connect the docker socket inside the container to reuse the running docker service
  • Link jenkins master container
  • Run in the background

In case more parameters are needed to be passed to swarm plugin CLI use EXTRA_PARAMS variable. Possible variables:

 -autoDiscoveryAddress VAL : Use this address for udp-based auto-discovery
                             (default 255.255.255.255)
 -description VAL          : Description to be put on the slave
 -disableSslVerification   : Disables SSL verification in the HttpClient.
 -executors N              : Number of executors
 -fsroot FILE              : Directory where Jenkins places files
 -help (--help)            : Show the help screen
 -labels VAL               : Whitespace-separated list of labels to be assigned
                             for this slave. Multiple options are allowed.
 -master VAL               : The complete target Jenkins URL like 'http://server
                             :8080/jenkins'. If this option is specified,
                             auto-discovery will be skipped
 -mode MODE                : The mode controlling how Jenkins allocates jobs to
                             slaves. Can be either 'normal' (utilize this slave
                             as much as possible) or 'exclusive' (leave this
                             machine for tied jobs only). Default is normal.
 -name VAL                 : Name of the slave
 -password VAL             : The Jenkins user password
 -username VAL             : The Jenkins username for authentication

Example:

docker run --link=jenkins:master -v /var/run/docker.sock:/var/run/docker.sock -e EXTRA_PARAMS="-description 'Jenkins Slave' -executors 2" -d seges/dind-jenkins-slave:1.3.0

Build

docker-compose build

Current version number is maintained in docker-compose.yml.

About

Docker-in-Docker Jenkins Slave

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 79.6%
  • Shell 20.4%