SlideShare a Scribd company logo
Using Docker for Testing
Carlos Sanchez

@csanchez
About
Senior Software Engineer @ CloudBees
Author of Jenkins Kubernetes plugin
Long time OSS contributor at Apache
Maven, Eclipse, Puppet,…
Containers & micro
services
@YourTwitterHandle
Docker
Linux containers
Union File
System
File System Users
Processes Network
But it is not trivial
Docker
Linux required
but
Docker Machine (formerly Boot2Docker)
to the rescue
OS X
Windows
Docker
Build once, run anywhere (kind of)
Bare metal
Virtual Machines
Cloud
Docker
Using Docker for Testing
developer oriented
Dependency hell
installation nightmares
“it ran on my machine”
ops oriented
no need to know internals of apps
focus on OPs problems
(scale, monitoring,…)
clearer deliverables from dev
@YourTwitterHandle
Docker delivery
Docker image
Docker infrastructure
App System
Using Docker for Testing
Using Docker for Testing
Related projects
Docker Machine
Provision Docker engines
VirtualBox, replaces boot2docker !
Amazon EC2
Microsoft Azure
Google Compute Engine
OpenStack
Rackspace
VMware
…
Docker Swarm
Clustering for Docker containers
Using the same API
Integrates with Mesos / Mesosphere
And planned
Amazon EC2 Container Service (ECS)
Google Kubernetes
IBM Bluemix Container Service
Joyent Smart Data Center
Microsoft Azure
Docker Compose
Orchestration of multi-container apps
Based on Fig
Defined by:
containers
configuration
links
volumes
Apache Mesos
A distributed systems kernel
Docker Containerizer
Marathon & Chronos
Docker & Jenkins
What are we trying to solve
Different projects, different requirements
languages (Java, Ruby,…)
tools (Maven, Ant, …)
system libraries (OpenSSL, …)
operating systems (Debian, Red Hat,…)
external dependencies (MySQL, Postgres)
@YourTwitterHandle
Initial solution
Jenkins master
slave 3
slave 2
slave 1
Using Docker for Testing
Using Docker for Testing
Using Docker for Testing
Dockerfile
# A Debian based image
FROM jenkinsci/jnlp-slave
RUN apt-get update 
&& apt-get install -y mysql 
&& rm -rf /var/lib/apt/lists/*
Dockerfile
FROM centos
RUN yum -y install openjdk-8 mysql
ENV JENKINS_REMOTING_VERSION 2.52
ENV HOME /home/jenkins
RUN useradd -c "Jenkins user" -d $HOME -m jenkins
RUN curl --create-dirs -sSLo /usr/share/jenkins/remoting-
$JENKINS_REMOTING_VERSION.jar http://repo.jenkins-ci.org/public/
org/jenkins-ci/main/remoting/$JENKINS_REMOTING_VERSION/remoting-
$JENKINS_REMOTING_VERSION.jar 
&& chmod 755 /usr/share/jenkins
COPY jenkins-slave.sh /usr/local/bin/jenkins-slave.sh
USER jenkins
VOLUME /home/jenkins
ENTRYPOINT ["/usr/local/bin/jenkins-slave.sh"]
Docker plugin
Docker plugin
As a plugin
on demand slaves
https://github.com/jenkinsci/docker-plugin
@YourTwitterHandle
Jenkins master
slave 3
slave 2
slave 1
Using Docker for Testing
CloudBees Docker
Custom Build
Environment Plugin
Custom Build Environment
Avoid dependencies in Jenkins
Containers are completely isolated
Use any executor/slave
@YourTwitterHandle
Jenkins master slave
container
docker exec
Using Docker for Testing
Dockerfile
FROM centos
RUN yum -y install openjdk-8 mysql
ENV JENKINS_REMOTING_VERSION 2.52
ENV HOME /home/jenkins
RUN useradd -c "Jenkins user" -d $HOME -m jenkins
RUN curl --create-dirs -sSLo /usr/share/jenkins/remoting-
$JENKINS_REMOTING_VERSION.jar http://repo.jenkins-ci.org/public/
org/jenkins-ci/main/remoting/$JENKINS_REMOTING_VERSION/remoting-
$JENKINS_REMOTING_VERSION.jar 
&& chmod 755 /usr/share/jenkins
COPY jenkins-slave.sh /usr/local/bin/jenkins-slave.sh
USER jenkins
VOLUME /home/jenkins
ENTRYPOINT ["/usr/local/bin/jenkins-slave.sh"]
Custom Build Environment
Take advantage of all pre-built Docker
images
java, ruby, python, maven,…
Docker images are now a deliverable
Docker images are part of the pipeline
Build/test/deploy images
Deliver as any other artifact
even if not used to run production systems
More Docker!
@YourTwitterHandle
Jenkins plugins
Docker
CloudBees
Docker Custom
Build Environment
CloudBees Docker
Build and Publish
CloudBees Docker
Hub Notification
CloudBees Docker
Traceability
docker-build-step
Docker workflow Kubernetes Mesos
Build and Publish
Docker Hub Notification
Docker & Selenium
Selenium
Manage multiple combinations of
browsers
Any number of them
Standalone or Selenium Hub
even with VNC
Using Docker for Testing
Using Docker for Testing
Selenium Hub
hub:
image: selenium/hub:2.48.2
ports:
- "4444:4444"
firefox:
image: selenium/node-firefox-debug:2.48.2
links:
- hub
ports:
- "5901:5900"
chrome:
image: selenium/node-chrome-debug:2.48.1
links:
- hub
ports:
- "5902:5900"
Kubernetes
Kubernetes
Container cluster orchestration
Docker containers across multiple hosts
(nodes or minions)
Higher level API
Enforced state
Monitoring of endpoints
Using Docker for Testing
Providers
GKE
Azure
Vmware
Rackspace
oVirt
Vagrant
CloudStack
Ubuntu
Pod
Group of colocated containers
Same network namespace/IP
Environment variables
Shared volumes
host mounted
empty volumes
GCE data disks
AWS EBS volumes
nfs
glusterfs
secrets
@YourTwitterHandle
Pods
Node
client
kubelet
pods
Master
Node
kubelet
pods
Node
kubelet
pods
… … …
Pod
kind: "Pod"
apiVersion: "v1"
metadata:
name: "jenkins"
labels:
name: "jenkins"
spec:
containers:
-
name: "jenkins"
image: "csanchez/jenkins-swarm:
1.625.1-for-volumes"
ports:
- containerPort: 8080
- containerPort: 50000
volumeMounts:
- name: "jenkins-data"
mountPath: "/var/jenkins_home"
volumes:
- name: "jenkins-data"
hostPath:
path: "/home/docker/jenkins"
Kubernetes Jenkins
plugin
Kubernetes Jenkins plugin
As a plugin
on demand slaves
https://github.com/jenkinsci/kubernetes-
plugin
Using Docker for Testing
Using Docker for Testing
Danke!
Using Docker for Testing

More Related Content

PPTX
Javaone 2014 - Git & Docker with Jenkins
PPTX
Continuous Delivery with Jenkins and Wildfly (2014)
PPTX
Seven Habits of Highly Effective Jenkins Users (2014 edition!)
PPTX
DevOps and Continuous Delivery reference architectures for Docker
PDF
Git and GitHub for Documentation
ODP
7 Habits of Highly Effective Jenkins Users
PDF
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
PDF
Continuous Delivery with Jenkins Workflow
Javaone 2014 - Git & Docker with Jenkins
Continuous Delivery with Jenkins and Wildfly (2014)
Seven Habits of Highly Effective Jenkins Users (2014 edition!)
DevOps and Continuous Delivery reference architectures for Docker
Git and GitHub for Documentation
7 Habits of Highly Effective Jenkins Users
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
Continuous Delivery with Jenkins Workflow

What's hot (20)

PDF
Continuous Delivery in Enterprise Environments using Docker, Ansible and Jenkins
PPT
Git 101 - Crash Course in Version Control using Git
PDF
Rise of the Machines - Automate your Development
PDF
CI is dead, long live CI
PPTX
2016 Docker Palo Alto - CD with ECS and Jenkins
PDF
Jenkins Best Practices
PDF
Pimp your Continuous Delivery Pipeline with Jenkins workflow (W-JAX 14)
PDF
JavaCro'14 - Continuous delivery of Java EE applications with Jenkins and Doc...
PDF
Master Continuous Delivery with CloudBees Jenkins Platform
PPTX
How Docker simplifies CI/CD
PDF
Testing with Docker
PPTX
Introduction to jenkins
PDF
At Your Service: Using Jenkins in Operations
PDF
Gitlab Training with GIT and SourceTree
PDF
Dockercon2015 bamboo
PPTX
Getting started with Jenkins
PDF
Analyze This! CloudBees Jenkins Cluster Operations and Analytics
PDF
Rundeck + Nexus (from Nexus Live on June 5, 2014)
PDF
Jenkins Workflow Webinar - Dec 10, 2014
PPTX
Continuous Delivery with Jenkins & Kubernetes @ Sky
Continuous Delivery in Enterprise Environments using Docker, Ansible and Jenkins
Git 101 - Crash Course in Version Control using Git
Rise of the Machines - Automate your Development
CI is dead, long live CI
2016 Docker Palo Alto - CD with ECS and Jenkins
Jenkins Best Practices
Pimp your Continuous Delivery Pipeline with Jenkins workflow (W-JAX 14)
JavaCro'14 - Continuous delivery of Java EE applications with Jenkins and Doc...
Master Continuous Delivery with CloudBees Jenkins Platform
How Docker simplifies CI/CD
Testing with Docker
Introduction to jenkins
At Your Service: Using Jenkins in Operations
Gitlab Training with GIT and SourceTree
Dockercon2015 bamboo
Getting started with Jenkins
Analyze This! CloudBees Jenkins Cluster Operations and Analytics
Rundeck + Nexus (from Nexus Live on June 5, 2014)
Jenkins Workflow Webinar - Dec 10, 2014
Continuous Delivery with Jenkins & Kubernetes @ Sky
Ad

Viewers also liked (9)

PPTX
GitFlow, SourceTree and GitLab
ODP
Ic maven jenkins_sonar
PDF
Game of Codes: the Battle for CI
PDF
Git best practices workshop
PDF
Bamboo - an introduction
PPTX
Introduction to Git/Github - A beginner's guide
PDF
Jenkins Docker
PDF
Git 101: Git and GitHub for Beginners
PPT
Speaking part 3
GitFlow, SourceTree and GitLab
Ic maven jenkins_sonar
Game of Codes: the Battle for CI
Git best practices workshop
Bamboo - an introduction
Introduction to Git/Github - A beginner's guide
Jenkins Docker
Git 101: Git and GitHub for Beginners
Speaking part 3
Ad

Similar to Using Docker for Testing (20)

PDF
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
PDF
Dockerized maven
PDF
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
PDF
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
PDF
Testing Distributed Micro Services. Agile Testing Days 2017
PPTX
Kubernetes Jenkins Docker Deployments on Google Cloud k8s in Jenkins Meetup G...
PDF
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
PDF
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
PDF
Pimp your jenkins platform with docker - Devops.com 2015/11
PPT
Jenkins on Docker
PDF
Docker + jenkins in the enterprise (3)
PDF
Cicd.pdf
PDF
From Monolith to Docker Distributed Applications
PDF
Dockerized tests with dockerized jenkins
PDF
Effective Data Pipelines with Docker & Jenkins - Brian Donaldson
ODP
Scaling your jenkins master with docker
PDF
JUC Europe 2015: Scaling Your Jenkins Master with Docker
PDF
Continuous Integration/Deployment with Docker and Jenkins
PDF
Scaling Jenkins with Docker and Kubernetes
PDF
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Using Containers for Building and Testing: Docker, Kubernetes and Mesos. FOSD...
Dockerized maven
Scaling Jenkins with Docker: Swarm, Kubernetes or Mesos?
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
Testing Distributed Micro Services. Agile Testing Days 2017
Kubernetes Jenkins Docker Deployments on Google Cloud k8s in Jenkins Meetup G...
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
CI and CD at Scale: Scaling Jenkins with Docker and Apache Mesos
Pimp your jenkins platform with docker - Devops.com 2015/11
Jenkins on Docker
Docker + jenkins in the enterprise (3)
Cicd.pdf
From Monolith to Docker Distributed Applications
Dockerized tests with dockerized jenkins
Effective Data Pipelines with Docker & Jenkins - Brian Donaldson
Scaling your jenkins master with docker
JUC Europe 2015: Scaling Your Jenkins Master with Docker
Continuous Integration/Deployment with Docker and Jenkins
Scaling Jenkins with Docker and Kubernetes
Enabling Hybrid Workflows with Docker/Mesos @Orbitz

More from Carlos Sanchez (20)

PDF
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
PDF
Using Kubernetes for Continuous Integration and Continuous Delivery
PDF
Divide and Conquer: Easier Continuous Delivery using Micro-Services
PDF
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
PDF
Using Containers for Continuous Integration and Continuous Delivery
PDF
Divide and Conquer: Easier Continuous Delivery using Micro-Services
PDF
From Monolith to Docker Distributed Applications. JavaOne
PDF
From Monolith to Docker Distributed Applications
PDF
Scaling Docker with Kubernetes
PPTX
Scaling Jenkins with Docker and Kubernetes
PDF
Scaling Docker with Kubernetes
PDF
Continuous Delivery: The Next Frontier
PDF
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
PDF
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
PDF
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
KEY
Puppet for Java developers - JavaZone NO 2012
PDF
From Dev to DevOps - Codemotion ES 2012
KEY
From Dev to DevOps - FOSDEM 2012
KEY
From Dev to DevOps - ApacheCON NA 2011
KEY
From Dev to DevOps - Apache Barcamp Spain 2011
Using Containers for Continuous Integration and Continuous Delivery. KubeCon ...
Using Kubernetes for Continuous Integration and Continuous Delivery
Divide and Conquer: Easier Continuous Delivery using Micro-Services
Using Kubernetes for Continuous Integration and Continuous Delivery. Java2days
Using Containers for Continuous Integration and Continuous Delivery
Divide and Conquer: Easier Continuous Delivery using Micro-Services
From Monolith to Docker Distributed Applications. JavaOne
From Monolith to Docker Distributed Applications
Scaling Docker with Kubernetes
Scaling Jenkins with Docker and Kubernetes
Scaling Docker with Kubernetes
Continuous Delivery: The Next Frontier
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Puppet for Java developers - JavaZone NO 2012
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - ApacheCON NA 2011
From Dev to DevOps - Apache Barcamp Spain 2011

Recently uploaded (20)

PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
sap open course for s4hana steps from ECC to s4
PPT
Teaching material agriculture food technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Cloud computing and distributed systems.
PDF
Empathic Computing: Creating Shared Understanding
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Approach and Philosophy of On baking technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MIND Revenue Release Quarter 2 2025 Press Release
Programs and apps: productivity, graphics, security and other tools
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Building Integrated photovoltaic BIPV_UPV.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
“AI and Expert System Decision Support & Business Intelligence Systems”
sap open course for s4hana steps from ECC to s4
Teaching material agriculture food technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Big Data Technologies - Introduction.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Cloud computing and distributed systems.
Empathic Computing: Creating Shared Understanding
Advanced methodologies resolving dimensionality complications for autism neur...
Approach and Philosophy of On baking technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

Using Docker for Testing