DevEX - reference for building teams, processes, and platforms
CI, CD with Docker, Jenkins and Tutum
1. CI, CD WITH DOCKER,
JENKINS AND TUTUM
Presenter Name: Sreenivas Makam
Presented at: Gopaddle Meetup Bangalore
Presentation Date: Jan 23, 2016
2. About me
• Senior Engineering Manager at Cisco
Systems Data Center group
• Personal blog can be found at
https://sreeninet.wordpress.com/ and my
hacky code at https://github.com/smakam
• Working currently on “Mastering CoreOS”
book. To be published early March 2016.
(http://www.amazon.com/Mastering-
CoreOS-Sreenivas-Makam-
ebook/dp/B01AI0NKRQ/ref=sr_1_1?ie=UT
F8&qid=1453472526&sr=8-
1&keywords=mastering+coreos)
• You can reach me on LinkedIn at
https://in.linkedin.com/in/sreenivasmaka
m
3. CI/CD definition
• Continuous Integration (CI) refers to the
process of making an executable or a Container
image automatically after developer has done
the UT and commit.
• Continuous delivery refers to the process of
taking the developer built image, setting up the
staging environment for testing the image and
deploying it successfully for production.
4. Why Docker is suited for CI/CD?
• Ability to create consistent build environments
• Build environments can be created and removed
with ease
• Ability to run multiple isolated build jobs
• Create consistent staging and production
deployment environment
• Assists with different upgrade patterns(like
Rolling upgrade with Canary pattern)
5. Jenkins with Docker - Advantages
• Jenkins provides the complete workflow for
CI/CD and has good integration with testing and
code analysis tools.
• Docker provides Containers and Container
related tools.
• Jenkins with Docker gives a Container based
CI/CD workflow and integration with third-party
tools for creating a customized workflow.
• Jenkins can be run as Docker Container
6. Jenkins Docker plugins
• Docker Workflow – provides first-class support for Jenkins Workflow to build real
world CD pipelines for containerized applications using Jenkins and Docker
• Build and Publish – builds projects from a Dockerfile and pushes a tested and
proven gold image to Docker Hub
• Docker Hub Notification – triggers downstream jobs when a tagged container is
pushed to Docker Hub
• Docker Traceability – identifies which build pushed a particular container that is
running in production and displays that on the Jenkins builds page
• Docker Slaves – uses Docker containers as standardized build environments
shared between Jenkins masters to improve isolation and elasticity
• Docker Custom Build Environment – specifies customized build environments as
Docker containers
Source:
https://www.cloudbees.com/continuous-delivery/jenkins-docker
7. Jenkins Docker slave
• Rather than running builds jobs directly on slave host,
Jenkins Docker executors creates Containers to run build
jobs.
• For different projects, different Docker Containers can be
used.
• Parallel jobs can be run on a single slave host with full
isolation between jobs.
• To create Docker builds inside a Docker Container, either
Docker in Docker can be used or Docker socket in host can
be exposed to CI container by bind-mounting it with the -
v flag
docker run -v /var/run/docker.sock:/var/run/docker.sock ...
8. Jenkins with Docker – Use cases
• Create Docker Container images with Github and Docker
repository integration.
Github -> Jenkins -> Docker slave -> Docker image ->
Dockerhub
• Ability to run multiple Docker build executors in a single
Jenkins slave instance.
Github -> Jenkins -> Docker slave -> C programming project -
> Testing
Github -> Jenkins -> Docker slave -> Java programming
project -> Testing
• Deploy Container images in staging or production
Docker hub -> Jenkins -> Docker slave -> Testing ->
Deployment using docker-compose
9. Tutum
• SaaS Container platform that can be used to build,
deploy and manage Docker Containers
• Hides orchestration, networking and storage
complexity.
• Provides GUI, CLI as well as API access
• Gives own private repository within Tutum per user,
other repositories can also be used
• Logging, monitoring, Scaling and HA is built-in
• Does rolling upgrade automatically
• In Beta phase, free to try
10. Tutum for CI, CD
• Tutum integrates well with Github as well as
all Docker repositories.
• Provides private Docker registry in Tutum
• Tutum CI/CD Use case
Github ->Tutum -> Tutum repository -> Deploy
• Provides flexibility to create different staging
and production deployment environments
• Provides rolling upgrade capability
11. Comparing Tutum with Jenkins
• Jenkins provides better integration with third-party
testing and code analysis tools.
• Tutum is available only as SaaS. Jenkins can be run on-
premise.
• Tutum provides its own registry, inherent load
balancing, service discovery capabilities and rolling
upgrade facilities.
• For pure Container based CI/CD, Tutum would be
better. If there is a need to integrate legacy and
Container based applications and also use third-party
tools, Jenkins is the only option.
12. CI, CD Demo
Github project
(https://github.com/smakam/
hit-counter-demo)
Jenkins
Docker slave
Dockerhub
Smakam/hit-counter-
demo
Docker hub
(Smakam/countertest)
Docker-compose
deploy
Tutum
tutum.co/smakam/cou
nt
Stackfile
Deploy
User commit
Auto Trigger
13. Related blogs
More details on this topic and recorded demo
are in the 2 blogs below:
• https://sreeninet.wordpress.com/2016/01/2
3/tutum-introduction/
• https://sreeninet.wordpress.com/2016/01/2
3/ci-cd-with-docker-jenkins-and-tutum/
14. References
• Jenkins Docker plugin (https://wiki.jenkins-
ci.org/display/JENKINS/Docker+Plugin)
• Docker CI Use case (https://www.docker.com/products/use-cases)
• Continuous delivery with Docker and Jenkins
(https://www.docker.com/sites/default/files/UseCase/RA_CI%20with%2
0Docker_08.25.2015.pdf, https://pages.cloudbees.com/rs/083-PKZ-
512/images/Docker-Jenkins-Continuous-Delivery.pdf )
• Tutum Support (https://support.tutum.co)
• Docker in Docker for CI (http://jpetazzo.github.io/2015/09/03/do-not-
use-docker-in-docker-for-ci/, https://forums.docker.com/t/how-can-i-
run-docker-command-inside-a-docker-container/337/6 )
• CI platform (https://blog.codecentric.de/en/2015/10/continuous-
integration-platform-using-docker-container-jenkins-sonarqube-nexus-
gitlab/)