Docker for Integration 
Testing 
Wouter Danes 
Docker Amsterdam / Utrecht, 28 August 2014
API Platform 
Engineer
Agenda 
• Ways I use docker during development 
• Fitting docker into your build process 
• Docker maven integration
Ways I use docker during development
Shadow IT
Run ! 
“production” ! 
locally
Proofs! 
of! 
Concept
CI environment 
• Spawn build slaves 
• No port collisions 
• Replace D/T with feature branch deploys 
• No version / stack collisions in “environment”
Fitting docker into your build process
High level build process 
build test package test 
package 
publish
Docker commands per build step 
build test package test 
package 
publish 
build run 
start 
stop 
link 
expose 
tag 
push
Docker maven integration
build test package test 
package 
publish 
build run 
start 
stop 
link 
expose 
tag 
push 
resources 
compile 
test package integration-test 
verify 
install 
deploy 
Maven vs Docker
docker-maven-plugin 
• Build docker images 
• Start containers 
• Link containers 
• Wait for containers to finish initialisation 
• Expose URLs / port info to integration tests 
• Clean up 
• Push images to an index / registry
Demo project
References 
• Two docker blog posts: 
www.wouterdanes.net 
• Docker maven plugin: 
github.com/wouterd/docker-maven-plugin 
• 12 principles for developing containers well: 
12factor.net

Docker for Integration Testing