SlideShare a Scribd company logo
DOCKER AND JAVA
ANTHONY DAHANNE, CONFOO MONTRÉAL,
THURSDAY, MARCH 9TH, 2017
@anthonydahanne
http://blog.dahanne.net
„Anthony Dahanne, Software Engineer @ Terracotta,
a Software AG company
„Working on the Terracotta Management Console,
and its integration in Terracotta products
„And strong Docker supporter :-P , trying to
containerize as much as I can !
LET ME INTRODUCE MYSELF
AGENDA
•Docker fundamentals : quick recap
•Java applications in containers
• Hello world from a Java container
• SpringBoot app in a container (+ Maven + IntelliJ IDEA integrations)
• Multi container deployment
• Extras
• CI/CD on premises (Jenkins, Nexus) vs cloud based deployment
• Interacting with Docker from Java with Docker Java
DOCKER FUNDAMENTALS
QUICK RECAP.
VMS VS CONTAINERS
IT’S ALL ABOUT THE (LINUX?) KERNEL !
picture from http://www.enterprisetech.com/2014/08/18/ibm-techies-pit-docker-kvm-bare-metal/
DOCKER CONTAINERS / IMAGES : A PILE OF LAYERS
A DOCKER IMAGE IS A DIFF ON TOP OF ITS PARENT
picture from : https://docs.docker.com/v1.6/terms/layer/
Host OS
Docker daemon
Images Containers
Docker CLI
> docker run ubuntu bash
> docker ps
> docker images
> etc.
Docker Compose
> docker-compose build
> docker-compose up
> docker-compose kill
> etc.
Volumes
Kitematic
REST API
tcp (tls) / Unix socket
Host OS
Docker daemon
Ima Contai
ners
Volume
DOCKER VOCABULARY VS JAVA VOCABULARY
• Repository : houses grouped artifacts
• Artifact : org.ehcache:ehcache:3.1.3 (+type : jar/sources/etc.)
Group id VersionArtifact id
DOCKER VOCABULARY VS JAVA VOCABULARY
• Registry : hosts repositories
• Repositories : house collections of tagged images
• Image : localhost:5000/anthony/mycoolproduct:v2
DockerHub / quay.io / Registry V2
Registry location Repository name Tag
Host OS
Docker daemon
Images
DockerHub Registry
ubuntu
latest 12.04
anthonydahanne/terracotta
latest 4.3.1-oss
anthonydahanne/petclinic
Registry @ SoftwareAG
anthony/tmc
latest 5.0
Host OS
Docker daemon
Images
Docker CLI Docker CLI
REST API
tcp (tls) / Unix socket
JAVA APPLICATIONS IN CONTAINERS
FROM MAIN() TO THE CLOUD !
DEMO TIME !
• Hello world from a Java container
• SpringBoot app in a container (+ Maven + IntelliJ IDEA integrations)
n
…
PostgreSQL
Webapp with
Ehcache3 Clustered
Terracotta Server
MULTI CONTAINER DEPLOYMENT
Load Balancer + Webapp + Terracotta Server + PostgreSQL DB
LoadBalancer
DEMO TIME !
• Ehcache demo image design
• JHipster application with clustered caching
• Depends on Terracotta Server and a Database
• Ehcache demo cloud based deployment
• 1 PostgreSQL Database
• 1 Terracotta Server instance
• n Webapp instances
• 1 load balancer
EXTRAS
CI/CD, OTHER JAVA INTEGRATIONS
Deployment infra.
ON PREMISES CI/CD
RE USING EXISTING INFRA !
Git Repo
Jenkins
Commit & Push
Trigger mvn job
Create & Start Container
Docker
daemons
Regular
Slaves
Registry
Image build
Push image to registry
Docker
daemon
Download
Images
DOCKER CLOUD DEPLOYMENT
PUSH THAT CODE AROUND !
EC2 Azure GCE
DockerCloudGithub DockerHub
Commit & Push
Trigger Automated Build Trigger Redeploy / Scale
Create & Start Container
JENKINS DOCKER PLUGIN : ADD CONTAINER BASED SLAVES
INTERACTING WITH THE DOCKER DAEMON WITH DOCKER JAVA
DockerClient dockerClient = DockerClientBuilder.getInstance(dockerUrl).build();

Info info = dockerClient.infoCmd().exec();



List<Container> containers = dockerClient.listContainersCmd()
.withShowAll(false)
.exec();
CreateContainerResponse container = dockerClient.createContainerCmd("busybox")
.withCmd("touch", "/test")
.exec();
dockerClient.startContainerCmd(container.getId()).exec();
dockerClient.stopContainerCmd(container.getId()).exec();
<dependency>
<groupId>com.github.docker-java</groupId>
<artifactId>docker-java</artifactId>
<version>3.0.1</version>
</dependency>
Demo at available at : https://github.com/anthonydahanne/montrealjug_docker_java/tree/04_spring_boot_app_docker_api
LINKS OF INTERESTS
• Docker labs, self paced (great to learn Docker !)
https://training.docker.com/category/self-paced-online
https://github.com/docker/labs/tree/master/beginner
• Jenkins plugins
https://wiki.jenkins-ci.org/display/JENKINS/Support+Core+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/Docker+build+step+plugin
https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Build+and+Publish+plugin
• DockerHub repositories
https://hub.docker.com/_/openjdk/
https://hub.docker.com/_/jenkins/
https://hub.docker.com/_/maven/
https://hub.docker.com/r/anthonydahanne/terracotta-server-oss/
• Others
https://wiki.eclipse.org/Linux_Tools_Project/Docker_Tooling/User_Guide
https://plugins.jetbrains.com/plugin/7724 use socat with Docker For Mac !
http://www.sonatype.org/nexus/2015/09/22/docker-and-nexus-3-ready-set-action/
• Docker & Java talks
The JVM and Docker. A good idea? by Christopher Batey
Docker Tips & Tricks for Java Developers, by Ray Tsang
21

More Related Content

PPTX
Containerless in the Cloud with AWS Lambda
PPTX
Getting Started With Docker on AWS
PPTX
DevOps On AWS - Deep Dive on Continuous Delivery
PDF
AWS Lambda from the trenches
PDF
New AWS Services
PDF
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
PPTX
Amazon ECS at Coursera: A unified execution framework while defending against...
PPTX
Continuous delivery and deployment on AWS
Containerless in the Cloud with AWS Lambda
Getting Started With Docker on AWS
DevOps On AWS - Deep Dive on Continuous Delivery
AWS Lambda from the trenches
New AWS Services
2016 - Easing Your Way Into Docker: Lessons From a Journey to Production
Amazon ECS at Coursera: A unified execution framework while defending against...
Continuous delivery and deployment on AWS

What's hot (7)

PDF
AWS IoT 핸즈온 워크샵 - 실습 2. SNS 연동과 Lambda로 메시지 처리하기 (김무현 솔루션즈 아키텍트)
PPTX
Docker & ECS: Secure Nearline Execution
PDF
Serverless in Java Lessons learnt
PDF
Boot Loot
PDF
Serverless in java Lessons learnt
PDF
Play Framework + Docker + CircleCI + AWS + EC2 Container Service
PDF
Running Docker Containers on AWS
AWS IoT 핸즈온 워크샵 - 실습 2. SNS 연동과 Lambda로 메시지 처리하기 (김무현 솔루션즈 아키텍트)
Docker & ECS: Secure Nearline Execution
Serverless in Java Lessons learnt
Boot Loot
Serverless in java Lessons learnt
Play Framework + Docker + CircleCI + AWS + EC2 Container Service
Running Docker Containers on AWS
Ad

Viewers also liked (20)

PPTX
Docker and java, at Montréal JUG
PDF
Terracotta Ehcache : Simpler, faster, distributed
PPTX
Top 50 java ee 7 best practices [con5669]
PDF
Microservices Minus the Hype: How to Build and Why
PDF
Docker for Java Developers
PDF
Docker for Java Developers
PDF
Docker 101: Introduction to Docker
PPTX
Faster Java EE Builds with Gradle
PPTX
moscmy2016: Extending Docker
PDF
Deploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
PDF
georchestra SDI: Project Status Report
PDF
Introduction to Docker - Learning containerization XP conference 2016
PPT
Dont judge challenge sharpie
PPTX
sectores economicos
PDF
Using docker to develop NAS applications
PPT
Koloid
PDF
WebShell - confoo 2011 - sean coates
PDF
Docker for the Brave
PPTX
Containers for sensor web services, applications and research @ Sensor Web Co...
PPTX
Hybrid Mobile Development with Apache Cordova and
Docker and java, at Montréal JUG
Terracotta Ehcache : Simpler, faster, distributed
Top 50 java ee 7 best practices [con5669]
Microservices Minus the Hype: How to Build and Why
Docker for Java Developers
Docker for Java Developers
Docker 101: Introduction to Docker
Faster Java EE Builds with Gradle
moscmy2016: Extending Docker
Deploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
georchestra SDI: Project Status Report
Introduction to Docker - Learning containerization XP conference 2016
Dont judge challenge sharpie
sectores economicos
Using docker to develop NAS applications
Koloid
WebShell - confoo 2011 - sean coates
Docker for the Brave
Containers for sensor web services, applications and research @ Sensor Web Co...
Hybrid Mobile Development with Apache Cordova and
Ad

Similar to Docker and java (20)

PDF
Docker for dev
PDF
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
PPTX
Dockerize the World
PPTX
Docker SF Meetup January 2016
PDF
Docker for Developers
PDF
Application Deployment on Openstack
PDF
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
PPTX
ma-formation-en-Docker-jlklk,nknkjn.pptx
PPTX
How to build an HA container orchestrator infrastructure for production – Giu...
PDF
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
PDF
Docker Oxford launch - Introduction to Docker
PDF
Get you Java application ready for Kubernetes !
PPTX
Containerization using docker and its applications
PPTX
Containerization using docker and its applications
PPTX
What's New in Docker - February 2017
PDF
codemotion-docker-2014
PDF
Kubernetes for Java Developers
PPTX
Dockerize the World - presentation from Hradec Kralove
PDF
ContainerDayVietnam2016: Dockerize a small business
PPTX
DockerCon 15 Keynote - Day 2
Docker for dev
PuppetConf 2017: What’s in the Box?!- Leveraging Puppet Enterprise & Docker- ...
Dockerize the World
Docker SF Meetup January 2016
Docker for Developers
Application Deployment on Openstack
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
ma-formation-en-Docker-jlklk,nknkjn.pptx
How to build an HA container orchestrator infrastructure for production – Giu...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Docker Oxford launch - Introduction to Docker
Get you Java application ready for Kubernetes !
Containerization using docker and its applications
Containerization using docker and its applications
What's New in Docker - February 2017
codemotion-docker-2014
Kubernetes for Java Developers
Dockerize the World - presentation from Hradec Kralove
ContainerDayVietnam2016: Dockerize a small business
DockerCon 15 Keynote - Day 2

More from Anthony Dahanne (18)

PDF
JDConf 2025 - Paketo Buildpacks : the best way to build Java container images
PPTX
Not a Kubernetes fan? The state of PaaS in 2025
PPTX
No More Dockerfiles! Buildpacks to Help You Ship Your Image!
PDF
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
PPTX
Not a Kubernetes fan? The state of PaaS in 2024
PPTX
No more Dockerfiles? Buildpacks to help you ship your image!
PPTX
CNCF Québec Meetup du 16 Novembre 2023
PDF
Buildpacks: the other way to build container images
PDF
Tu changes d'emploi - retour d'experience d'un développeur
PPTX
Java applications containerized and deployed
PDF
Contribuer à la traduction française de kubernetes
PDF
Kubernetes Java Operator
PDF
Caching in applications still matters
PDF
Kubernetes for java developers - Tutorial at Oracle Code One 2018
PDF
Writing a Jenkins / Hudson plugin
PDF
Confoo2013 make your java-app rest enabled
ODP
Ci for-android-apps
ODP
Asynctasks
JDConf 2025 - Paketo Buildpacks : the best way to build Java container images
Not a Kubernetes fan? The state of PaaS in 2025
No More Dockerfiles! Buildpacks to Help You Ship Your Image!
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Not a Kubernetes fan? The state of PaaS in 2024
No more Dockerfiles? Buildpacks to help you ship your image!
CNCF Québec Meetup du 16 Novembre 2023
Buildpacks: the other way to build container images
Tu changes d'emploi - retour d'experience d'un développeur
Java applications containerized and deployed
Contribuer à la traduction française de kubernetes
Kubernetes Java Operator
Caching in applications still matters
Kubernetes for java developers - Tutorial at Oracle Code One 2018
Writing a Jenkins / Hudson plugin
Confoo2013 make your java-app rest enabled
Ci for-android-apps
Asynctasks

Recently uploaded (20)

PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
System and Network Administraation Chapter 3
PPTX
Introduction to Artificial Intelligence
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
AI in Product Development-omnex systems
PPTX
Transform Your Business with a Software ERP System
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
System and Network Administration Chapter 2
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
medical staffing services at VALiNTRY
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
history of c programming in notes for students .pptx
PPTX
L1 - Introduction to python Backend.pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
ISO 45001 Occupational Health and Safety Management System
System and Network Administraation Chapter 3
Introduction to Artificial Intelligence
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
AI in Product Development-omnex systems
Transform Your Business with a Software ERP System
CHAPTER 2 - PM Management and IT Context
System and Network Administration Chapter 2
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Softaken Excel to vCard Converter Software.pdf
Operating system designcfffgfgggggggvggggggggg
Adobe Illustrator 28.6 Crack My Vision of Vector Design
medical staffing services at VALiNTRY
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
history of c programming in notes for students .pptx
L1 - Introduction to python Backend.pptx
Upgrade and Innovation Strategies for SAP ERP Customers
Wondershare Filmora 15 Crack With Activation Key [2025
2025 Textile ERP Trends: SAP, Odoo & Oracle
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx

Docker and java

  • 1. DOCKER AND JAVA ANTHONY DAHANNE, CONFOO MONTRÉAL, THURSDAY, MARCH 9TH, 2017 @anthonydahanne http://blog.dahanne.net
  • 2. „Anthony Dahanne, Software Engineer @ Terracotta, a Software AG company „Working on the Terracotta Management Console, and its integration in Terracotta products „And strong Docker supporter :-P , trying to containerize as much as I can ! LET ME INTRODUCE MYSELF
  • 3. AGENDA •Docker fundamentals : quick recap •Java applications in containers • Hello world from a Java container • SpringBoot app in a container (+ Maven + IntelliJ IDEA integrations) • Multi container deployment • Extras • CI/CD on premises (Jenkins, Nexus) vs cloud based deployment • Interacting with Docker from Java with Docker Java
  • 5. VMS VS CONTAINERS IT’S ALL ABOUT THE (LINUX?) KERNEL ! picture from http://www.enterprisetech.com/2014/08/18/ibm-techies-pit-docker-kvm-bare-metal/
  • 6. DOCKER CONTAINERS / IMAGES : A PILE OF LAYERS A DOCKER IMAGE IS A DIFF ON TOP OF ITS PARENT picture from : https://docs.docker.com/v1.6/terms/layer/
  • 7. Host OS Docker daemon Images Containers Docker CLI > docker run ubuntu bash > docker ps > docker images > etc. Docker Compose > docker-compose build > docker-compose up > docker-compose kill > etc. Volumes Kitematic REST API tcp (tls) / Unix socket Host OS Docker daemon Ima Contai ners Volume
  • 8. DOCKER VOCABULARY VS JAVA VOCABULARY • Repository : houses grouped artifacts • Artifact : org.ehcache:ehcache:3.1.3 (+type : jar/sources/etc.) Group id VersionArtifact id
  • 9. DOCKER VOCABULARY VS JAVA VOCABULARY • Registry : hosts repositories • Repositories : house collections of tagged images • Image : localhost:5000/anthony/mycoolproduct:v2 DockerHub / quay.io / Registry V2 Registry location Repository name Tag
  • 10. Host OS Docker daemon Images DockerHub Registry ubuntu latest 12.04 anthonydahanne/terracotta latest 4.3.1-oss anthonydahanne/petclinic Registry @ SoftwareAG anthony/tmc latest 5.0 Host OS Docker daemon Images Docker CLI Docker CLI REST API tcp (tls) / Unix socket
  • 11. JAVA APPLICATIONS IN CONTAINERS FROM MAIN() TO THE CLOUD !
  • 12. DEMO TIME ! • Hello world from a Java container • SpringBoot app in a container (+ Maven + IntelliJ IDEA integrations)
  • 13. n … PostgreSQL Webapp with Ehcache3 Clustered Terracotta Server MULTI CONTAINER DEPLOYMENT Load Balancer + Webapp + Terracotta Server + PostgreSQL DB LoadBalancer
  • 14. DEMO TIME ! • Ehcache demo image design • JHipster application with clustered caching • Depends on Terracotta Server and a Database • Ehcache demo cloud based deployment • 1 PostgreSQL Database • 1 Terracotta Server instance • n Webapp instances • 1 load balancer
  • 15. EXTRAS CI/CD, OTHER JAVA INTEGRATIONS
  • 16. Deployment infra. ON PREMISES CI/CD RE USING EXISTING INFRA ! Git Repo Jenkins Commit & Push Trigger mvn job Create & Start Container Docker daemons Regular Slaves Registry Image build Push image to registry Docker daemon Download Images
  • 17. DOCKER CLOUD DEPLOYMENT PUSH THAT CODE AROUND ! EC2 Azure GCE DockerCloudGithub DockerHub Commit & Push Trigger Automated Build Trigger Redeploy / Scale Create & Start Container
  • 18. JENKINS DOCKER PLUGIN : ADD CONTAINER BASED SLAVES
  • 19. INTERACTING WITH THE DOCKER DAEMON WITH DOCKER JAVA DockerClient dockerClient = DockerClientBuilder.getInstance(dockerUrl).build();
 Info info = dockerClient.infoCmd().exec();
 
 List<Container> containers = dockerClient.listContainersCmd() .withShowAll(false) .exec(); CreateContainerResponse container = dockerClient.createContainerCmd("busybox") .withCmd("touch", "/test") .exec(); dockerClient.startContainerCmd(container.getId()).exec(); dockerClient.stopContainerCmd(container.getId()).exec(); <dependency> <groupId>com.github.docker-java</groupId> <artifactId>docker-java</artifactId> <version>3.0.1</version> </dependency> Demo at available at : https://github.com/anthonydahanne/montrealjug_docker_java/tree/04_spring_boot_app_docker_api
  • 20. LINKS OF INTERESTS • Docker labs, self paced (great to learn Docker !) https://training.docker.com/category/self-paced-online https://github.com/docker/labs/tree/master/beginner • Jenkins plugins https://wiki.jenkins-ci.org/display/JENKINS/Support+Core+Plugin https://wiki.jenkins-ci.org/display/JENKINS/Docker+build+step+plugin https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Build+and+Publish+plugin • DockerHub repositories https://hub.docker.com/_/openjdk/ https://hub.docker.com/_/jenkins/ https://hub.docker.com/_/maven/ https://hub.docker.com/r/anthonydahanne/terracotta-server-oss/ • Others https://wiki.eclipse.org/Linux_Tools_Project/Docker_Tooling/User_Guide https://plugins.jetbrains.com/plugin/7724 use socat with Docker For Mac ! http://www.sonatype.org/nexus/2015/09/22/docker-and-nexus-3-ready-set-action/ • Docker & Java talks The JVM and Docker. A good idea? by Christopher Batey Docker Tips & Tricks for Java Developers, by Ray Tsang
  • 21. 21