Docker and Jenkins

The idea : Make all your Build with Jenkins on always the same environment : controlled, stable ..

What we will do :

  • Jenkins run a docker container
  • Jenkins run a temp slave in the container
  • The build is done on the slave container and jenkins take the result of the build (logs, metadata, artifacts)
  • Whent the build is done the container is killed

Install Docker

Install Jenkins

Pull a debian image

Prepare a dockerfile

FROM wheezy64:wheezy

RUN apt-get install -y openssh-server openjdk-7-jre-headless
RUN useradd -m -s /bin/bash jenkins
RUN echo jenkins:jenkins | chpasswd
RUN mkdir -p /var/run/sshd
CMD /usr/sbin/sshd -D

Build a jenkins image
docker build -t wheezy_jenkins:jenkins .

We can test by running the container and connect with ssh
$ jenkins=$(docker run -d -p -t -i wheezy_jenkins:jenkins)

$ ssh jenkins@localhost -p 2222

Whe exit from the ssh session

Then kill the container
docker kill $jenkins

Then delete the container
docker rm $jenkins

Now we will configure jenkins

install the docker plugin on jenkins (cf our post to know how to install plugin :jenkins_pluging )

configure jenkins : cloud and had your docker container

create an item

then compute

mobydock father

More Posts - Website

Follow Me:

Jenkins from scratch – HowTo part 1 – go onboard

This howto will help you to begin with jenkins.


First step install jenkins :
wget -q -O - | sudo apt-key add -
sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

If you already installed Jenkins and need to be up to date :
sudo apt-get update
sudo apt-get install jenkins

When it’s done, you’ll access Jenkins:
with your navigator using URL : http://localhost:8080

or with the CLI(command line interface)
to install it :
wget http://localhost:8080/jnlpJars/jenkins-cli.jar
There’s a doc online the local website http://localhost:8080/cli
and also can have detail on options :
java -jar jenkins-cli.jar -s http://localhost:8080/ help

mobydock father

More Posts - Website

Follow Me:

Welcome on board ! Bienvenue !

This this IT !
Hope you will enjoy this blog, wiki, workshop site. I will try to share what you need about devops.

Je me lance dans la mise en route de ce site mélangeant blog, wiki, Learning tips, vidéo,..etc..
Mon objectif est simple : partager la culture devops
Les outils, les méthodes , les approches, … mais également l’actualité devops

Je vous ferais découvrir ou redécouvrir des post sur Docker, Ansible, Vagrant, Puppet, Chef, Cloudstack, …. ou sur Kanban, Lean, Agile, mais aussi des informations sur les event à ne pas rater : devopsdays, dockercon, …

Que du bonheur !
A bientôt et rester connecté .
Be alive , Be Devops

mobydock father

More Posts - Website

Follow Me: