SlideShare a Scribd company logo
1 of 30
Download to read offline
Docker + Java
Elek Márton
@anzix
2015 March
DPC Consulting
Docker+Java
What is docker
● Lightweight virtualization
– Container
● Repository of virtual images
– 100 official image
– ~45000 public images
● Versioning support
– To upgrade a container
● Only for linux
– Just a filesystem, the kernel of the host system is used
– Windows out of scope
● Similar to
– BSD jails, Linux LXC, Solaris zones
Docker run
Docker run
Docker run
Two main use case
Start a predefined
container
docker run jenkins
Start a command in a
well defined env
docker run ubuntu
uname -a
docker run ubuntu
bash
Volumes
● Every container is a one time container.
– All of the files will be deleted together with the container
● What about persisted data?
– Solution: volumes
docker run -v /root/jenkins:/var/jenkins_home 
jenkins
● How to access?
– By default docker containers use internal unique IP
– An additional process forwards ports
● Port forwards should be defined
docker run -v /root/jenkins:/var/jenkins_home 
-p 4567:8080 jenkins
Port forward
Create a docker container
● Snapshot an existing container
– Easy but non reproducible
– docker commit
● Create step-by-step from an existing container
– docker build .
FROM java:8
ADD build/version /app/version
WORKDIR /app
CMD ["bin/start.sh"]
● Usually one process
“In almost all cases, you should only run a single
process in a single container.
Decoupling applications into multiple containers makes
it much easier to scale horizontally and reuse
containers. If that service depends on another service,
make use of container linking.”
Docker best practices
What is inside a container
Docker ps
Upload to a repository
● docker push/pull
● Very similar to the git concept
– Versions
– Tagging
docker images
docker tag 8dbd9e392a dpc.hu:5000/backend
docker push dpc.hu:5000/ubuntu
Repository servers:
● docker
● artifactory
Docker definition
“Docker is an open platform for developers and
sysadmins to build, ship, and run distributed
applications.
Consisting of Docker Engine, a portable,
● lightweight runtime and
● packaging tool, and
● Docker Hub, a cloud service for sharing
applications and automating workflows”
Docker definition
“… Docker enables apps
to be quickly assembled from components
● and eliminates the friction between
● development, QA, and production
environments.”
“As a result, IT can ship faster and run the same app,
unchanged, on laptops, data center VMs, and any
cloud.”
What is missing
● How to create an alias for a complex command line
– Docker compose (was fig)
– Crane
● How to manage multiple machines all
together/schedule containers
– Kubernetes, OpenShift
● Hande logical group of containers together
– Kubernetes, OpenShift
Docker is ecosystem
● ContainerOS
– CoreOS, Project Atomic, Boot2Docker
● Open source PaaS
– Flynn, Dokuu, Deis
● Scheduler/Orchestration/Management
– Kubernetes, Crane, Docker Compose(fig)
● Continuous Integration
– Jennkins plugins, …
See also https://www.mindmeister.com/389671722/docker-ecosystem
(Without) Docker compose
docker run --name mysqldb
-e MYSQL_USER=mysql
-e MYSQL_PASSWORD=mysql
-e MYSQL_DATABASE=sample
-e MYSQL_ROOT_PASSWORD=supersecret
-d mysql
docker run --name mywildfly --link mysqldb:db
-p 8080:8080
-d arungupta/wildfly-mysql-javaee7
Docker compose
mysqldb:
image: mysql:latest
environment:
MYSQL_DATABASE: sample
MYSQL_USER: mysql
MYSQL_PASSWORD: mysql
MYSQL_ROOT_PASSWORD: supersecret
mywildfly:
image: arungupta/wildfly-mysql-javaee7
links:
- mysqldb:db
ports:
- 8080:8080
Use it from Windows/OSX/...
● Boot2docker
– Minimal virtual container (Virtualbox)
– Tools to run containers in the Virtualbox
● Docker Machine installer
– Windows/Linux/OSX
Who uses it?
● All of the big players:
● Amazon Beanstalk
– Dedicated container based hosting
● Google Cloud Platform
– Containers on Google Cloud Platform powered by
kubernetes
● RedHat OpenShift v3
– The new version is based on kubernetes/docker
● HP
– Operations Orchestration
And others...
Docker+Java
Example standalone app
Dockerfile
FROM java:8
WORKDIR /myapp
CMD ["bin/myproj"]
COPY build/install/myproj /myapp
mvn install/gradle package
docker build .
//upload to the repository with docker push
docker pull dpc.hu:5000/backend
docker run dpc.hu:5000/backend
Example J2EE application
FROM jboss/wildfly
RUN add-user.sh admin Admin#70365 --silent
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b",
"0.0.0.0", "-bmanagement", "0.0.0.0"]
COPY target/helloworld.war
/opt/jboss/wildfly/standalone/deployments/
Recipes
● Arun Gupta:
9 Docker recipes for Java EE
Applications
– Use Docker Machine
– Link local mysql and wildfly together
– Link remote containers
– Deploy Java EE Application from Eclipse
Maven/SBT/Gradle
docker plugin
Artifactory
Continuous Deployment
See: Delivery pipline and zero downtime
Arquilian Cube (1.0.0 Alpha4)
“With this extension you can start a Docker container with a server installed,
deploy the required deployable file within it and execute Arquillian tests.
The key point here is that if Docker is used as deployable platform in
production, your tests are executed in a the same container as it will be in
production, so your tests are even more real than before.
But it also lets you start a container with every required service like database,
mail server, … and instead of stubbing or using fake objects your tests can use
real servers.”
https://github.com/arquillian/arquillian-cube
Summary
● Container technology is the present
– lightweight virtualization
– packaging
– repository
● Reusable components
– Continuous delivery
– Use exactly the same environment
– limit resources
– Easy to create test containers
● Growing ecosystem
– Supported solutions from the biggest vendors to the
smallest startup

More Related Content

What's hot

Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to KubernetesAmy Chen
 
Introduction to Kubernetes and Google Container Engine (GKE)
Introduction to Kubernetes and Google Container Engine (GKE)Introduction to Kubernetes and Google Container Engine (GKE)
Introduction to Kubernetes and Google Container Engine (GKE)Opsta
 
Deploying your first application with Kubernetes
Deploying your first application with KubernetesDeploying your first application with Kubernetes
Deploying your first application with KubernetesOVHcloud
 
Architectural caching patterns for kubernetes
Architectural caching patterns for kubernetesArchitectural caching patterns for kubernetes
Architectural caching patterns for kubernetesRafał Leszko
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopBob Killen
 
Brief Introduction To Kubernetes
Brief Introduction To KubernetesBrief Introduction To Kubernetes
Brief Introduction To KubernetesAvinash Ketkar
 
Commit to excellence - Java in containers
Commit to excellence - Java in containersCommit to excellence - Java in containers
Commit to excellence - Java in containersRed Hat Developers
 
Kubernetes Requests and Limits
Kubernetes Requests and LimitsKubernetes Requests and Limits
Kubernetes Requests and LimitsAhmed AbouZaid
 
Tupperware: Containerized Deployment at FB
Tupperware: Containerized Deployment at FBTupperware: Containerized Deployment at FB
Tupperware: Containerized Deployment at FBDocker, Inc.
 
Getting started with kubernetes
Getting started with kubernetesGetting started with kubernetes
Getting started with kubernetesJanakiram MSV
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewBob Killen
 
KubeCon EU 2016: Bringing an open source Containerized Container Platform to ...
KubeCon EU 2016: Bringing an open source Containerized Container Platform to ...KubeCon EU 2016: Bringing an open source Containerized Container Platform to ...
KubeCon EU 2016: Bringing an open source Containerized Container Platform to ...KubeAcademy
 
Distributed Locking in Kubernetes
Distributed Locking in KubernetesDistributed Locking in Kubernetes
Distributed Locking in KubernetesRafał Leszko
 
Kubernetes in Docker
Kubernetes in DockerKubernetes in Docker
Kubernetes in DockerDocker, Inc.
 
(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive OverviewBob Killen
 
Top 3 reasons why you should run your Enterprise workloads on GKE
Top 3 reasons why you should run your Enterprise workloads on GKETop 3 reasons why you should run your Enterprise workloads on GKE
Top 3 reasons why you should run your Enterprise workloads on GKESreenivas Makam
 
The evolving container landscape
The evolving container landscapeThe evolving container landscape
The evolving container landscapeNilesh Trivedi
 
How to Integrate Kubernetes in OpenStack
 How to Integrate Kubernetes in OpenStack  How to Integrate Kubernetes in OpenStack
How to Integrate Kubernetes in OpenStack Meng-Ze Lee
 

What's hot (20)

Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Introduction to Kubernetes and Google Container Engine (GKE)
Introduction to Kubernetes and Google Container Engine (GKE)Introduction to Kubernetes and Google Container Engine (GKE)
Introduction to Kubernetes and Google Container Engine (GKE)
 
Deploying your first application with Kubernetes
Deploying your first application with KubernetesDeploying your first application with Kubernetes
Deploying your first application with Kubernetes
 
Architectural caching patterns for kubernetes
Architectural caching patterns for kubernetesArchitectural caching patterns for kubernetes
Architectural caching patterns for kubernetes
 
Introduction to Kubernetes Workshop
Introduction to Kubernetes WorkshopIntroduction to Kubernetes Workshop
Introduction to Kubernetes Workshop
 
Brief Introduction To Kubernetes
Brief Introduction To KubernetesBrief Introduction To Kubernetes
Brief Introduction To Kubernetes
 
Commit to excellence - Java in containers
Commit to excellence - Java in containersCommit to excellence - Java in containers
Commit to excellence - Java in containers
 
Kubernetes Requests and Limits
Kubernetes Requests and LimitsKubernetes Requests and Limits
Kubernetes Requests and Limits
 
Tupperware: Containerized Deployment at FB
Tupperware: Containerized Deployment at FBTupperware: Containerized Deployment at FB
Tupperware: Containerized Deployment at FB
 
Getting started with kubernetes
Getting started with kubernetesGetting started with kubernetes
Getting started with kubernetes
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive Overview
 
KubeCon EU 2016: Bringing an open source Containerized Container Platform to ...
KubeCon EU 2016: Bringing an open source Containerized Container Platform to ...KubeCon EU 2016: Bringing an open source Containerized Container Platform to ...
KubeCon EU 2016: Bringing an open source Containerized Container Platform to ...
 
Distributed Locking in Kubernetes
Distributed Locking in KubernetesDistributed Locking in Kubernetes
Distributed Locking in Kubernetes
 
Kubernetes in Docker
Kubernetes in DockerKubernetes in Docker
Kubernetes in Docker
 
(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview(Draft) Kubernetes - A Comprehensive Overview
(Draft) Kubernetes - A Comprehensive Overview
 
Top 3 reasons why you should run your Enterprise workloads on GKE
Top 3 reasons why you should run your Enterprise workloads on GKETop 3 reasons why you should run your Enterprise workloads on GKE
Top 3 reasons why you should run your Enterprise workloads on GKE
 
The evolving container landscape
The evolving container landscapeThe evolving container landscape
The evolving container landscape
 
Crafting Kubernetes Operators
Crafting Kubernetes OperatorsCrafting Kubernetes Operators
Crafting Kubernetes Operators
 
From Code to Kubernetes
From Code to KubernetesFrom Code to Kubernetes
From Code to Kubernetes
 
How to Integrate Kubernetes in OpenStack
 How to Integrate Kubernetes in OpenStack  How to Integrate Kubernetes in OpenStack
How to Integrate Kubernetes in OpenStack
 

Similar to Docker + Java: How to Build and Run Java Apps in Containers

Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme PetazzoniWorkshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme PetazzoniTheFamily
 
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionIntroduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionJérôme Petazzoni
 
Introduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New YorkIntroduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New YorkJérôme Petazzoni
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesJérôme Petazzoni
 
Docker on Power Systems
Docker on Power SystemsDocker on Power Systems
Docker on Power SystemsCesar Maciel
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsElasTest Project
 
Accelerate your development with Docker
Accelerate your development with DockerAccelerate your development with Docker
Accelerate your development with DockerAndrey Hristov
 
Accelerate your software development with Docker
Accelerate your software development with DockerAccelerate your software development with Docker
Accelerate your software development with DockerAndrey Hristov
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET DevelopersTaswar Bhatti
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsMicael Gallego
 
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik DornJDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik DornPROIDEA
 
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Jérôme Petazzoni
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxIgnacioTamayo2
 
Introduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange CountyIntroduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange CountyJérôme Petazzoni
 
Continuous Integration with Docker on AWS
Continuous Integration with Docker on AWSContinuous Integration with Docker on AWS
Continuous Integration with Docker on AWSAndrew Heifetz
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
Introduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxDataIntroduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxDataInfluxData
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday developmentJustyna Ilczuk
 

Similar to Docker + Java: How to Build and Run Java Apps in Containers (20)

Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme PetazzoniWorkshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
Workshop : 45 minutes pour comprendre Docker avec Jérôme Petazzoni
 
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionIntroduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" Edition
 
Introduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New YorkIntroduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New York
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los Angeles
 
Docker on Power Systems
Docker on Power SystemsDocker on Power Systems
Docker on Power Systems
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
 
Accelerate your development with Docker
Accelerate your development with DockerAccelerate your development with Docker
Accelerate your development with Docker
 
Accelerate your software development with Docker
Accelerate your software development with DockerAccelerate your software development with Docker
Accelerate your software development with Docker
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
 
Using Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and JenkinsUsing Docker to build and test in your laptop and Jenkins
Using Docker to build and test in your laptop and Jenkins
 
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik DornJDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
 
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Introduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange CountyIntroduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange County
 
Continuous Integration with Docker on AWS
Continuous Integration with Docker on AWSContinuous Integration with Docker on AWS
Continuous Integration with Docker on AWS
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Introduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxDataIntroduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxData
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 

More from DPC Consulting Ltd

More from DPC Consulting Ltd (9)

Scaling on AWS
Scaling on AWSScaling on AWS
Scaling on AWS
 
Jsonp coding dojo
Jsonp coding dojoJsonp coding dojo
Jsonp coding dojo
 
Garbage First Garbage Collector Algorithm
Garbage First Garbage Collector AlgorithmGarbage First Garbage Collector Algorithm
Garbage First Garbage Collector Algorithm
 
Power tools in Java
Power tools in JavaPower tools in Java
Power tools in Java
 
Két Java fejlesztő első Scala projektje
Két Java fejlesztő első Scala projektjeKét Java fejlesztő első Scala projektje
Két Java fejlesztő első Scala projektje
 
Server in your Client
Server in your ClientServer in your Client
Server in your Client
 
OSGi as Enterprise Integration Platform
OSGi as Enterprise Integration PlatformOSGi as Enterprise Integration Platform
OSGi as Enterprise Integration Platform
 
Full stack security
Full stack securityFull stack security
Full stack security
 
Java 9 and Project Jigsaw
Java 9 and Project JigsawJava 9 and Project Jigsaw
Java 9 and Project Jigsaw
 

Recently uploaded

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Recently uploaded (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

Docker + Java: How to Build and Run Java Apps in Containers

  • 1. Docker + Java Elek Márton @anzix 2015 March DPC Consulting
  • 3. What is docker ● Lightweight virtualization – Container ● Repository of virtual images – 100 official image – ~45000 public images ● Versioning support – To upgrade a container ● Only for linux – Just a filesystem, the kernel of the host system is used – Windows out of scope ● Similar to – BSD jails, Linux LXC, Solaris zones
  • 7. Two main use case Start a predefined container docker run jenkins Start a command in a well defined env docker run ubuntu uname -a docker run ubuntu bash
  • 8. Volumes ● Every container is a one time container. – All of the files will be deleted together with the container ● What about persisted data? – Solution: volumes docker run -v /root/jenkins:/var/jenkins_home jenkins
  • 9. ● How to access? – By default docker containers use internal unique IP – An additional process forwards ports ● Port forwards should be defined docker run -v /root/jenkins:/var/jenkins_home -p 4567:8080 jenkins Port forward
  • 10. Create a docker container ● Snapshot an existing container – Easy but non reproducible – docker commit ● Create step-by-step from an existing container – docker build . FROM java:8 ADD build/version /app/version WORKDIR /app CMD ["bin/start.sh"]
  • 11. ● Usually one process “In almost all cases, you should only run a single process in a single container. Decoupling applications into multiple containers makes it much easier to scale horizontally and reuse containers. If that service depends on another service, make use of container linking.” Docker best practices What is inside a container
  • 13. Upload to a repository ● docker push/pull ● Very similar to the git concept – Versions – Tagging docker images docker tag 8dbd9e392a dpc.hu:5000/backend docker push dpc.hu:5000/ubuntu Repository servers: ● docker ● artifactory
  • 14. Docker definition “Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications. Consisting of Docker Engine, a portable, ● lightweight runtime and ● packaging tool, and ● Docker Hub, a cloud service for sharing applications and automating workflows”
  • 15. Docker definition “… Docker enables apps to be quickly assembled from components ● and eliminates the friction between ● development, QA, and production environments.” “As a result, IT can ship faster and run the same app, unchanged, on laptops, data center VMs, and any cloud.”
  • 16. What is missing ● How to create an alias for a complex command line – Docker compose (was fig) – Crane ● How to manage multiple machines all together/schedule containers – Kubernetes, OpenShift ● Hande logical group of containers together – Kubernetes, OpenShift
  • 17. Docker is ecosystem ● ContainerOS – CoreOS, Project Atomic, Boot2Docker ● Open source PaaS – Flynn, Dokuu, Deis ● Scheduler/Orchestration/Management – Kubernetes, Crane, Docker Compose(fig) ● Continuous Integration – Jennkins plugins, … See also https://www.mindmeister.com/389671722/docker-ecosystem
  • 18. (Without) Docker compose docker run --name mysqldb -e MYSQL_USER=mysql -e MYSQL_PASSWORD=mysql -e MYSQL_DATABASE=sample -e MYSQL_ROOT_PASSWORD=supersecret -d mysql docker run --name mywildfly --link mysqldb:db -p 8080:8080 -d arungupta/wildfly-mysql-javaee7
  • 19. Docker compose mysqldb: image: mysql:latest environment: MYSQL_DATABASE: sample MYSQL_USER: mysql MYSQL_PASSWORD: mysql MYSQL_ROOT_PASSWORD: supersecret mywildfly: image: arungupta/wildfly-mysql-javaee7 links: - mysqldb:db ports: - 8080:8080
  • 20. Use it from Windows/OSX/... ● Boot2docker – Minimal virtual container (Virtualbox) – Tools to run containers in the Virtualbox ● Docker Machine installer – Windows/Linux/OSX
  • 21. Who uses it? ● All of the big players: ● Amazon Beanstalk – Dedicated container based hosting ● Google Cloud Platform – Containers on Google Cloud Platform powered by kubernetes ● RedHat OpenShift v3 – The new version is based on kubernetes/docker ● HP – Operations Orchestration And others...
  • 23. Example standalone app Dockerfile FROM java:8 WORKDIR /myapp CMD ["bin/myproj"] COPY build/install/myproj /myapp mvn install/gradle package docker build . //upload to the repository with docker push docker pull dpc.hu:5000/backend docker run dpc.hu:5000/backend
  • 24. Example J2EE application FROM jboss/wildfly RUN add-user.sh admin Admin#70365 --silent CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"] COPY target/helloworld.war /opt/jboss/wildfly/standalone/deployments/
  • 25. Recipes ● Arun Gupta: 9 Docker recipes for Java EE Applications – Use Docker Machine – Link local mysql and wildfly together – Link remote containers – Deploy Java EE Application from Eclipse
  • 28. Continuous Deployment See: Delivery pipline and zero downtime
  • 29. Arquilian Cube (1.0.0 Alpha4) “With this extension you can start a Docker container with a server installed, deploy the required deployable file within it and execute Arquillian tests. The key point here is that if Docker is used as deployable platform in production, your tests are executed in a the same container as it will be in production, so your tests are even more real than before. But it also lets you start a container with every required service like database, mail server, … and instead of stubbing or using fake objects your tests can use real servers.” https://github.com/arquillian/arquillian-cube
  • 30. Summary ● Container technology is the present – lightweight virtualization – packaging – repository ● Reusable components – Continuous delivery – Use exactly the same environment – limit resources – Easy to create test containers ● Growing ecosystem – Supported solutions from the biggest vendors to the smallest startup