SlideShare a Scribd company logo
1 of 26
August Penguin 2016
DOCKER
For Java Developers
Ala Hino
Senior Software Engineer
ahino@redhat.com
www.linkedin.com/in/alahino
Who Am I?
Test
Test
●
●
●My name is Ala
●I am a Senior Software Engineer @ Red Hat
●I work on oVirt and on RHV (previously known as RHEV)
At the end of this session, you will:
Test
Test
●
●
●Understand what Docker is, in general
●Understand how to run a Java application inside a container
●Underdstand advantages of Docker
●
Test
Test
●
●
●
●Once upon a time ...
●
What is Docker?
Test
Test
●From Docker website:
●
●
* https://www.docker.com/what-docker
** https://medium.freecodecamp.com/a-beginner-friendly-introduction-to-containers-vms-and-docker-
79a9e3e119b#.tm4j9hsmf
PACKAGE YOUR APPLICATION INTO A STANDARDIZED UNIT FOR SOFTWARE
DEVELOPMENT*
Docker containers wrap a piece of software in a complete filesystem that contains everything needed
to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This
guarantees that the software will always run the same, regardless of its environment*
LIGHTWEIGHT
Containers running on a single machine
share the same operating system
kernel; they start instantly and use less
RAM. Images are constructed from
layered filesystems and share common
files, making disk usage and image
downloads much more efficient*
OPEN
Docker containers are based on open
standards, enabling containers to run on
all major Linux distributions and on
Microsoft Windows -- and on top of any
infrastructure
SECURE BY DEFAULT
Containers isolate applications from one
another and the underlying
infrastructure, while providing an added
layer of protection for the application*
- an open source project to pack, ship and run any application as a lightweight container
- provides os-level virtualization
- lightweight, easy of use, docker hub
Unlike a VM which provides hardware
virtualization, a container provides
operating-system-level virtualization by
abstracting the “user space”. You’ll see
what I mean as we unpack the term
container**
I am a Java developer, what do I need to know?
Image: defines the application dependencies and how it is packaged. This is done
using a Dockerfile
Container: the “box” that wraps the application providing everything the application
needs to run
Docker hub: the public Docker registry. The repository where images are published
From a Java app to a Docker image
Test
Test
●
●
● 1. Prepare your Java app
1.2. Prepare Dockerfile
2.3. Build the image
3.4. Run & test
4.5. Publish the image
1)
1. My Java App
package august.penguin.yr16;
public class HelloWorld {
    public static void main(String... args) {
        System.out.println("Hello, World. I am an app inside a container!!!");
    }
}
2. Dockerfile
FROM maven:latest
COPY src /usr/aug-penguin/src
COPY pom.xml /usr/aug-penguin/pom.xml
WORKDIR /usr/aug-penguin
RUN mvn clean install
ENTRYPOINT ["java", "-cp", "/usr/aug-penguin/target/classes/", "august.penguin.yr16.HelloWorld"]
3. Building the image
$ docker build -t ahino/hello-world .
Sending build context to Docker daemon 68.61 kB
Step 0 : FROM maven:latest
---> e674c9bf6d88
Step 1 : COPY src /usr/aug-penguin/src
---> Using cache
---> 18b079e74156
Step 2 : COPY pom.xml /usr/aug-penguin/pom.xml
---> Using cache
---> b0d852d66049
Step 3 : WORKDIR /usr/aug-penguin
---> Using cache
---> 2bb642181d04
Step 4 : RUN mvn clean install
---> Using cache
---> 055cd9eac639
Step 5 : ENTRYPOINT java -cp /usr/aug-penguin/target/classes/ august.penguin.yr16.HelloWorld
---> Using cache
---> 39929150bd68
Successfully built 39929150bd68
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
ahino/hello-world latest 5d486d674197 2 hours ago 786.6 MB
4. Running the image
$ time docker run -t ahino/hello-world
Hello, World. I am an app inside a container!!!
real 0m0.706s
user 0m0.013s
sys 0m0.015s
5. Pushing the app to Docker hub
$ docker push ahino/hello-world
5d486d674197: Pushed
89543c931cc0: Pushed
…
latest: digest: sha256:5477f4f9b93ee0773723210418044b9a2219480eb82928c434de4eceb5e4f1b1
size: 48275
Nice, but ...
What's the catch ...
My first Docker use case
There is no bug here ...
2016-08-02 23:07:52,235 ERROR [org.ovirt.otopi.dialog.MachineDialogParser] (VdsDeploy) [6003e682] Cannot parse input:
java.lang.RuntimeException: Invalid data recieved during bootstrap
at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:370) [otopi.jar:]
at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:405) [otopi.jar:]
at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase._threadMain(VdsDeployBase.java:304) [bll.jar:]
at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase.access$800(VdsDeployBase.java:45) [bll.jar:]
at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase$12.run(VdsDeployBase.java:386) [bll.jar:]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_91]
2016-08-02 23:07:52,237 ERROR [org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase] (VdsDeploy) [6003e682] Error during deploy
dialog: java.lang.RuntimeException: Invalid data recieved during bootstrap
at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:370) [otopi.jar:]
at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:405) [otopi.jar:]
at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase._threadMain(VdsDeployBase.java:304) [bll.jar:]
at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase.access$800(VdsDeployBase.java:45) [bll.jar:]
at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase$12.run(VdsDeployBase.java:386) [bll.jar:]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_91]
2016-08-02 23:07:52,243 ERROR [org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase] (org.ovirt.thread.pool-9-thread-3) [6003e682]
Error during host rich-el72-host01.usersys.redhat.com install: java.lang.RuntimeException: Invalid data recieved during bootstrap
at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:370) [otopi.jar:]
at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:405) [otopi.jar:]
at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase._threadMain(VdsDeployBase.java:304) [bll.jar:]
at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase.access$800(VdsDeployBase.java:45) [bll.jar:]
at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase$12.run(VdsDeployBase.java:386) [bll.jar:]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_91]
Docker to the rescue
$ docker run ­t ovirt­engine:3.6.3
My second Docker use case
I want to improve logging performance ...
Let's Improve Performance (?)
slf4j 1.7.5
PERFORMANCE IMPROVEMENTS The logger factories in most SLF4J modules
namely in jcl-over-slf4j, log4j-over-slf4j, slf4j-jcl, slf4j-jdk14, slf4j-log4j12, and slf4j-
simple now use a ConcurrentHashMap instead of a regular HashMap to cache
logger instances. This change significantly improves logger retrieval times at the cost
of some memory overhead. This improvement was requested in bug #298 by Taras
Tielkes who also provided the relevant patch*
* http://www.slf4j.org/news.html
What went wrong?
In my development environment, I build the project using Maven.
pom.xml
In QA environment, they install RPMs.
ovirt-engine.spec.in
...
<slf4j.version>1.7.5</slf4j.version>
...
...
Requires:   slf4j >= 1.7.0
...
slf4j 1.7.20
Releases 1.7.19 and 1.7.20 suffer from a memory leak. Please use version 1.7.21 or
later instead.
Fixed initialization problem encountered on the Google App Engine platform with
SLF4J version 1.7.19 but not other versions. The problem was reported in SLF4J-
363 by Osvaldo Pinali Doederlein
Docker to the rescue
1. <update pom.xml>
2. $ docker build -t ovirt-engine:slf4j1.7.5
3. <run & test>
4. $ docker push -t ovirt-engine:slf4j1.7.5
More Docker usages
Running applications is isolated and simpler
E.g.
●- Java applications that use different Java versions
●- Web apps that run on different Tomcat versions
Q&A
Thank you!

More Related Content

What's hot

Managing dependencies with gradle
Managing dependencies with gradleManaging dependencies with gradle
Managing dependencies with gradleLiviu Tudor
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another buildIgor Khotin
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Tomek Kaczanowski
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerShip your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerMarcus Lönnberg
 
Unit Test Android Without Going Bald
Unit Test Android Without Going BaldUnit Test Android Without Going Bald
Unit Test Android Without Going BaldDavid Carver
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleSkills Matter
 
Continous delivery with sbt
Continous delivery with sbtContinous delivery with sbt
Continous delivery with sbtWojciech Pituła
 
NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6Kostas Saidis
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for androidzhang ghui
 
PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...
PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...
PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...Puppet
 
淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合Kyle Lin
 
Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolvedBhagwat Kumar
 
How to integrate front end tool via gruntjs
How to integrate front end tool via gruntjsHow to integrate front end tool via gruntjs
How to integrate front end tool via gruntjsBo-Yi Wu
 
Scala and Play with Gradle
Scala and Play with GradleScala and Play with Gradle
Scala and Play with GradleWei Chen
 
Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!Stacy Devino
 

What's hot (20)

Managing dependencies with gradle
Managing dependencies with gradleManaging dependencies with gradle
Managing dependencies with gradle
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another build
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
 
Ship your Scala code often and easy with Docker
Ship your Scala code often and easy with DockerShip your Scala code often and easy with Docker
Ship your Scala code often and easy with Docker
 
Unit Test Android Without Going Bald
Unit Test Android Without Going BaldUnit Test Android Without Going Bald
Unit Test Android Without Going Bald
 
In the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: GradleIn the Brain of Hans Dockter: Gradle
In the Brain of Hans Dockter: Gradle
 
Testing with PostgreSQL
Testing with PostgreSQLTesting with PostgreSQL
Testing with PostgreSQL
 
Continous delivery with sbt
Continous delivery with sbtContinous delivery with sbt
Continous delivery with sbt
 
NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for android
 
PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...
PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...
PuppetConf 2016: Deploying Multi-Tier Windows Applications with Application O...
 
淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合
 
Gradle - Build system evolved
Gradle - Build system evolvedGradle - Build system evolved
Gradle - Build system evolved
 
How to integrate front end tool via gruntjs
How to integrate front end tool via gruntjsHow to integrate front end tool via gruntjs
How to integrate front end tool via gruntjs
 
Scala and Play with Gradle
Scala and Play with GradleScala and Play with Gradle
Scala and Play with Gradle
 
Simple Build Tool
Simple Build ToolSimple Build Tool
Simple Build Tool
 
Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!Async task, threads, pools, and executors oh my!
Async task, threads, pools, and executors oh my!
 
Gradle como alternativa a maven
Gradle como alternativa a mavenGradle como alternativa a maven
Gradle como alternativa a maven
 

Similar to Aug penguin16

Scala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouJ On The Beach
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline Docker, Inc.
 
Vagrant or docker for java dev environment
Vagrant or docker for java dev environmentVagrant or docker for java dev environment
Vagrant or docker for java dev environmentOrest Ivasiv
 
Introduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud RunIntroduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud RunSaiyam Pathak
 
Webinar: Creating an Effective Docker Build Pipeline for Java Apps
Webinar: Creating an Effective Docker Build Pipeline for Java AppsWebinar: Creating an Effective Docker Build Pipeline for Java Apps
Webinar: Creating an Effective Docker Build Pipeline for Java AppsCodefresh
 
Java in a world of containers
Java in a world of containersJava in a world of containers
Java in a world of containersDocker, Inc.
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Arun Gupta
 
Developing with-devstack
Developing with-devstackDeveloping with-devstack
Developing with-devstackDeepak Garg
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Matt Raible
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Enginecatherinewall
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersJavan Rasokat
 
Creating Scalable JVM/Java Apps on Heroku
Creating Scalable JVM/Java Apps on HerokuCreating Scalable JVM/Java Apps on Heroku
Creating Scalable JVM/Java Apps on HerokuJoe Kutner
 
Deliver Python Apps with Docker
Deliver Python Apps with DockerDeliver Python Apps with Docker
Deliver Python Apps with DockerAnton Egorov
 
Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Matt Raible
 
[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?Izzet Mustafaiev
 
Minimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestrationMinimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestrationOutlyer
 
Writing Android Libraries
Writing Android LibrariesWriting Android Libraries
Writing Android Librariesemanuelez
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...Eric Smalling
 
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020Matt Raible
 

Similar to Aug penguin16 (20)

Scala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camouScala, docker and testing, oh my! mario camou
Scala, docker and testing, oh my! mario camou
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
 
Vagrant or docker for java dev environment
Vagrant or docker for java dev environmentVagrant or docker for java dev environment
Vagrant or docker for java dev environment
 
Introduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud RunIntroduction to JIB and Google Cloud Run
Introduction to JIB and Google Cloud Run
 
Webinar: Creating an Effective Docker Build Pipeline for Java Apps
Webinar: Creating an Effective Docker Build Pipeline for Java AppsWebinar: Creating an Effective Docker Build Pipeline for Java Apps
Webinar: Creating an Effective Docker Build Pipeline for Java Apps
 
Java in a world of containers
Java in a world of containersJava in a world of containers
Java in a world of containers
 
Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018Java in a World of Containers - DockerCon 2018
Java in a World of Containers - DockerCon 2018
 
Developing with-devstack
Developing with-devstackDeveloping with-devstack
Developing with-devstack
 
Test your modules
Test your modulesTest your modules
Test your modules
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
 
Creating Scalable JVM/Java Apps on Heroku
Creating Scalable JVM/Java Apps on HerokuCreating Scalable JVM/Java Apps on Heroku
Creating Scalable JVM/Java Apps on Heroku
 
Deliver Python Apps with Docker
Deliver Python Apps with DockerDeliver Python Apps with Docker
Deliver Python Apps with Docker
 
Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021
 
[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?
 
Minimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestrationMinimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestration
 
Writing Android Libraries
Writing Android LibrariesWriting Android Libraries
Writing Android Libraries
 
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
IBM Index 2018 Conference Workshop: Modernizing Traditional Java App's with D...
 
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
Java REST API Comparison: Micronaut, Quarkus, and Spring Boot - jconf.dev 2020
 

Recently uploaded

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Intelisync
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 

Recently uploaded (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)Introduction to Decentralized Applications (dApps)
Introduction to Decentralized Applications (dApps)
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 

Aug penguin16

  • 1. August Penguin 2016 DOCKER For Java Developers Ala Hino Senior Software Engineer ahino@redhat.com www.linkedin.com/in/alahino
  • 2. Who Am I? Test Test ● ● ●My name is Ala ●I am a Senior Software Engineer @ Red Hat ●I work on oVirt and on RHV (previously known as RHEV)
  • 3. At the end of this session, you will: Test Test ● ● ●Understand what Docker is, in general ●Understand how to run a Java application inside a container ●Underdstand advantages of Docker ●
  • 5. What is Docker? Test Test ●From Docker website: ● ● * https://www.docker.com/what-docker ** https://medium.freecodecamp.com/a-beginner-friendly-introduction-to-containers-vms-and-docker- 79a9e3e119b#.tm4j9hsmf PACKAGE YOUR APPLICATION INTO A STANDARDIZED UNIT FOR SOFTWARE DEVELOPMENT* Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment* LIGHTWEIGHT Containers running on a single machine share the same operating system kernel; they start instantly and use less RAM. Images are constructed from layered filesystems and share common files, making disk usage and image downloads much more efficient* OPEN Docker containers are based on open standards, enabling containers to run on all major Linux distributions and on Microsoft Windows -- and on top of any infrastructure SECURE BY DEFAULT Containers isolate applications from one another and the underlying infrastructure, while providing an added layer of protection for the application* - an open source project to pack, ship and run any application as a lightweight container - provides os-level virtualization - lightweight, easy of use, docker hub Unlike a VM which provides hardware virtualization, a container provides operating-system-level virtualization by abstracting the “user space”. You’ll see what I mean as we unpack the term container**
  • 6. I am a Java developer, what do I need to know? Image: defines the application dependencies and how it is packaged. This is done using a Dockerfile Container: the “box” that wraps the application providing everything the application needs to run Docker hub: the public Docker registry. The repository where images are published
  • 7. From a Java app to a Docker image Test Test ● ● ● 1. Prepare your Java app 1.2. Prepare Dockerfile 2.3. Build the image 3.4. Run & test 4.5. Publish the image 1)
  • 8. 1. My Java App package august.penguin.yr16; public class HelloWorld {     public static void main(String... args) {         System.out.println("Hello, World. I am an app inside a container!!!");     } }
  • 9. 2. Dockerfile FROM maven:latest COPY src /usr/aug-penguin/src COPY pom.xml /usr/aug-penguin/pom.xml WORKDIR /usr/aug-penguin RUN mvn clean install ENTRYPOINT ["java", "-cp", "/usr/aug-penguin/target/classes/", "august.penguin.yr16.HelloWorld"]
  • 10. 3. Building the image $ docker build -t ahino/hello-world . Sending build context to Docker daemon 68.61 kB Step 0 : FROM maven:latest ---> e674c9bf6d88 Step 1 : COPY src /usr/aug-penguin/src ---> Using cache ---> 18b079e74156 Step 2 : COPY pom.xml /usr/aug-penguin/pom.xml ---> Using cache ---> b0d852d66049 Step 3 : WORKDIR /usr/aug-penguin ---> Using cache ---> 2bb642181d04 Step 4 : RUN mvn clean install ---> Using cache ---> 055cd9eac639 Step 5 : ENTRYPOINT java -cp /usr/aug-penguin/target/classes/ august.penguin.yr16.HelloWorld ---> Using cache ---> 39929150bd68 Successfully built 39929150bd68 $ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE ahino/hello-world latest 5d486d674197 2 hours ago 786.6 MB
  • 11. 4. Running the image $ time docker run -t ahino/hello-world Hello, World. I am an app inside a container!!! real 0m0.706s user 0m0.013s sys 0m0.015s
  • 12. 5. Pushing the app to Docker hub $ docker push ahino/hello-world 5d486d674197: Pushed 89543c931cc0: Pushed … latest: digest: sha256:5477f4f9b93ee0773723210418044b9a2219480eb82928c434de4eceb5e4f1b1 size: 48275
  • 13. Nice, but ... What's the catch ...
  • 14. My first Docker use case There is no bug here ...
  • 15.
  • 16.
  • 17. 2016-08-02 23:07:52,235 ERROR [org.ovirt.otopi.dialog.MachineDialogParser] (VdsDeploy) [6003e682] Cannot parse input: java.lang.RuntimeException: Invalid data recieved during bootstrap at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:370) [otopi.jar:] at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:405) [otopi.jar:] at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase._threadMain(VdsDeployBase.java:304) [bll.jar:] at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase.access$800(VdsDeployBase.java:45) [bll.jar:] at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase$12.run(VdsDeployBase.java:386) [bll.jar:] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_91] 2016-08-02 23:07:52,237 ERROR [org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase] (VdsDeploy) [6003e682] Error during deploy dialog: java.lang.RuntimeException: Invalid data recieved during bootstrap at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:370) [otopi.jar:] at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:405) [otopi.jar:] at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase._threadMain(VdsDeployBase.java:304) [bll.jar:] at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase.access$800(VdsDeployBase.java:45) [bll.jar:] at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase$12.run(VdsDeployBase.java:386) [bll.jar:] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_91] 2016-08-02 23:07:52,243 ERROR [org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase] (org.ovirt.thread.pool-9-thread-3) [6003e682] Error during host rich-el72-host01.usersys.redhat.com install: java.lang.RuntimeException: Invalid data recieved during bootstrap at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:370) [otopi.jar:] at org.ovirt.otopi.dialog.MachineDialogParser.nextEvent(MachineDialogParser.java:405) [otopi.jar:] at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase._threadMain(VdsDeployBase.java:304) [bll.jar:] at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase.access$800(VdsDeployBase.java:45) [bll.jar:] at org.ovirt.engine.core.bll.hostdeploy.VdsDeployBase$12.run(VdsDeployBase.java:386) [bll.jar:] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_91]
  • 18. Docker to the rescue $ docker run ­t ovirt­engine:3.6.3
  • 19. My second Docker use case I want to improve logging performance ...
  • 20. Let's Improve Performance (?) slf4j 1.7.5 PERFORMANCE IMPROVEMENTS The logger factories in most SLF4J modules namely in jcl-over-slf4j, log4j-over-slf4j, slf4j-jcl, slf4j-jdk14, slf4j-log4j12, and slf4j- simple now use a ConcurrentHashMap instead of a regular HashMap to cache logger instances. This change significantly improves logger retrieval times at the cost of some memory overhead. This improvement was requested in bug #298 by Taras Tielkes who also provided the relevant patch* * http://www.slf4j.org/news.html
  • 21. What went wrong? In my development environment, I build the project using Maven. pom.xml In QA environment, they install RPMs. ovirt-engine.spec.in ... <slf4j.version>1.7.5</slf4j.version> ... ... Requires:   slf4j >= 1.7.0 ...
  • 22. slf4j 1.7.20 Releases 1.7.19 and 1.7.20 suffer from a memory leak. Please use version 1.7.21 or later instead. Fixed initialization problem encountered on the Google App Engine platform with SLF4J version 1.7.19 but not other versions. The problem was reported in SLF4J- 363 by Osvaldo Pinali Doederlein
  • 23. Docker to the rescue 1. <update pom.xml> 2. $ docker build -t ovirt-engine:slf4j1.7.5 3. <run & test> 4. $ docker push -t ovirt-engine:slf4j1.7.5
  • 24. More Docker usages Running applications is isolated and simpler E.g. ●- Java applications that use different Java versions ●- Web apps that run on different Tomcat versions
  • 25. Q&A

Editor's Notes

  1. Welcome to Red Hat Cloud Tour. Thank audience for attending cloud tour.