1. Improve your Java development env with
DOCKER
Compose & Machine
Copyright 2015 eXo Platform
2. About Us
Copyright 2015 eXo Platform
● Maxime Gréau
○ @mgreau
● Software Engineer at eXo
● Thomas Delhoménie
○ @tdelhomenie
● Software Engineer at eXo
3. Agenda
Copyright 2015 eXo Platform
1. Docker Toolbox
2. Work on multiple technical stacks
3. Uses cases “In A Container”
3.1. Debug
3.2. Code & Deploy
3.3. Deploy from your IDE
3.4. Build & Run with Maven Docker Plugins
3.5. Integration Tests
4. Reproduce production bugs easily
5. Work with an architecture closest to production
6. Do all the things with Docker & co
5. Problem 1: Dev environment setup time
Copyright 2015 eXo Platform
Welcome, it’s your first day, you just have to:
● Install Maven 3.2.3
● Install JDK 1.7.0_80
● Install Tomcat 7.0.63
● Install MySQL 5.5, PostgreSQL 9.1
● Read the installation doc…
9. Problem 3: the matrix hell
Copyright 2015 eXo Platform
MySQL 5.1 MySQL 5.5 Mongo 3.0 Java 7 Java 8
My first app v1 X X
My first app v2 X X X X
My other app v1 X X
...
10. Fix all those problems with 3 commands!
Copyright 2015 eXo Platform
Pre-requisites
docker, machine & compose installed
Then
1. Run git clone https://github.com/my-repo/my.git & cd my-project
2. Run docker-compose up
3. Open your browser
12. Docker Toolbox includes...
Copyright 2015 eXo Platform
● Docker Machine for running the docker-machine binary
● Docker Engine for running the docker binary
● Docker Compose for running the docker-compose binary
● Kitematic, the Docker GUI
● Oracle VM VirtualBox
Only for OSX
and Windows
13. Create dev environment
Copyright 2015 eXo Platform
Mac & Windows
> docker-machine create my-machine-name
> eval $(docker-machine env my-machine-name)
Linux
Nothing special to do!
24. Others use cases
Copyright 2015 eXo Platform
eXo use case : multi databases support (matrix compatibility pb)
PostgreSQL
9.3
MySQL 5.6MySQL 5.5 PostgreSQL
9.4
Oracle
11gR2
25. Others use cases
Copyright 2015 eXo Platform
Migration between 2 versions of the database
my-app
MySQL
5.5
my-app
MySQL
5.7
40. As a Developer you want to
Easily reproduce
production bugs
Copyright 2015 eXo Platform
41. Test with the production version of the “old” stack
Copyright 2015 eXo Platform
my-app
MySQL 5.5
my-app
MySQL 5.7
> git checkout v1
> “build”
> docker-compose up
New dev stackProd stack
5.5 5.7
v1 v2
42. As a Developer you want to
Work with an architecture
close to production
Copyright 2015 eXo Platform
51. Some best practices for development
Copyright 2015 eXo Platform
● Use Docker Machine to organize your images and limit resources usage
(CPU, memory, …)
● Use volume containers to keep your data safe (schema)
● Useful docker commands:
○ stopped docker containers : docker stop $(docker ps -q)
○ remove dangling docker images:
■ docker rmi $(docker images -q -f "dangling=true")
○ and more: https://github.com/javaee-samples/docker-
java/blob/master/chapters/docker-commands.adoc
52. Copyright 2015 eXo Platform
Docker doesn’t invent
the container technology,
BUT
make it possible to use it
easily on your laptop!
53. Improve your Java development env with
Docker Compose & Machine
Thanks
@tdelhomenie @mgreau
Code: http://github.com/mgreau/docker4dev-tennistour-app