Docker Global Hack Day Contribution

Written by: Nicolas De Loof
3 min read

I contributed the local edition for Docker Global Hack Day . I worked on a hack during the week-end with my colleague Yoann.

Our contribution is focussing on Docker use for Jenkins Continuous Integration - what a surprise! We used a proof-of-concept I wrote earlier and made it production ready (more or less) using latest Docker version docker exec command.

So let me introduce Oki-Docki !

This plugin is designed to let your Jenkins build run in a clean and controlled environment, managed as a Docker container, that you can define explicitly as a Docker image ID in jenkins job configuration, or as a Dockerfile you store with your project source code.

  • First usage (Docker image ID) is some way for you to have custom build agents based on Docker images, something comparable (but implemented a distinct way) to docker-plugin , without any constraint on the Docker image to use.

  • Second usage is something more subtle but imho more useful in terms or Continuous Delivery / reproducibility.

Docker based reproducible build environment

As a developer, I like my build to run on a fully controlled environment, so I can reproduce it at any time. Docker allows me to get this up-and-running in few seconds without a long list of prerequisites to check. It also let me define this build environment as a plain Dockerfile text file, that I can just store in project SCM. I'd like my continuous integration server to do the same.

Oki Docki plugin can use any Jenkins agent that has docker installed, so you can fully benefit Jenkins elasticity to connect additional agent boxes or even use a cloud provider. The SCM checkout runs a classic way on agent, but then a Docker container is build from project Dockerfile and ran to host the build. All subsequent build commands are ran inside the container (using docker exec introduced in 1.3.0).

After we got the initial setup done and sanity test running echo "hello docker" on build log, Yoann went further and tested using this plugin to run a debian package build job. Such a job works like a charm on my OSX / Boot2docker installation - If you ever tried to do cross-system packaging you understand the immediate benefit !

Generally speaking, this plugin let you fully define your build environment (which java, maven, ruby, compass, whatever version your build requires) just as a reproducible Dockerfile recipe. Maven tried to address this issue some way but don't have much control on the environment to fully address such an issue.

So thanks to Docker we moved from "maven reproducible builds " to "docker fully reproducible builds ", and Oki-Docki makes this perfectly fit in you CI system.

Nicolas De Loof
​Hacker
CloudBees

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.