Public Repository

Last pushed: 2 years ago
Short Description
Jenkins Master Server
Full Description

Jenkins Master Image Set Up To Use Docker on the host to build docker images in conjunction with CloudBees Docker Build and Publish Plugin. This container can either mount a volume to manage the Jenkins configuration data or can be used in conjunction with the jenkins-data data volume container (see devopsfuturists903/jenkins-data)

Dockerfile
http://52.9.35.134:8080/devopsfuturists/assignment-06-infrastructure/blob/master/jenkins/jenkins-master/Dockerfile

To run this image with user defined volume mount
docker run -d -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v /usr/lib/x86_64-linux-gnu/libapparmor.so.1.1.0:/lib/x86_64-linux-gnu/libapparmor.so.1 -p 8080:8080 -p 50000:50000 -v [Your Jenkins Home Volume] --name jenkins-master devopsfuturists903/jenkins-master

To run this image with jenkins-data container
Start the data container
docker run --name=jenkins-data devopsfuturists903/jenkins-data

Start the master container linking to the data container
docker run --name=jenkins-master -d --volumes-from=jenkins-data -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v /usr/lib/x86_64-linux-gnu/libapparmor.so.1.1.0:/lib/x86_64-linux-gnu/libapparmor.so.1 -p 8080:8080 -p 50000:50000 devopsfuturists903/jenkins-master

Notes
The volume mounts deserve some explanation

The first volume mount links all the volumes exposed by the jenkins-data container (jenkins_home and var/logs/jenkins)

The second volume mount mounts the docker daemon as a socket so the Jenkins container can use the host docker daemon to run jobs that create docker images for example

Backups
Backing Up Log Files
docker cp dev-jenkins-data:/var/log/jenkins/jenkins.log ~/backup/logs/jenkins.log

Backing Up Jenkins Config Files
docker cp dev-jenkins-data:/var/jenkins_home/config.xml ~/backup/config.xml

Backing up Jenkins Jobs
docker cp dev-jenkins-data:/var/jenkins_home/jobs ~/backup/jobs

Docker Pull Command
Owner
devopsfuturists903