Docker simplifies software delivery by making it easy to build and share images that contain your application’s operating system. It packages your application and infrastructure together, managed as one component. These images are then used to create Docker containers which run on the container virtualization platform, provided by Docker. These images can be distributed using Docker Registry. Docker gives PODA or Package Once Deploy Anywhere.
This talk will provide an introduction to Docker images (build time), containers (run time), and registry (distribution). Java EE application require operating system, JDK, database, application server, tuning of different parts of the stack, WAR file, and much more. The talk will explain how to create and publish your Docker images that package all of these components together. This will overall simplify replicating your development, test, and production environments. Attendees will be productive by applying these concepts in their daily work.
The talk will also discuss how to setup an internal registry to share private Docker images.
Session at the IndicThreads.com Confence held in Pune, India on 27-28 Feb 2015
http://www.indicthreads.com
http://pune15.indicthreads.com
20. Underlying Technology
• Written in Go
• Uses several Linux features
• Namespaces to provide isolation
• Control groups to share/limit hardware resources
21. Underlying Technology
• Written in Go
• Uses several Linux features
• Namespaces to provide isolation
• Control groups to share/limit hardware resources
• Union File System makes it light and fast
22. Underlying Technology
• Written in Go
• Uses several Linux features
• Namespaces to provide isolation
• Control groups to share/limit hardware resources
• Union File System makes it light and fast
• libcontainer defines container format
58. Arquillian Cube
• Controls the lifecycle of Docker images as part of
test cycle - automatically or manually
• Uses Docker REST API to talk to container
• Talk using WildFly remote adapter (in container)
• Try it out
http://blog.arungupta.me/run-javaee-tests-wildfly-docker-arquillian-cube/
60. Docker: Pros and Cons
• PROS
• Extreme application portability
• Very easy to create and work with derivative
• Fast boot on containers
61. Docker: Pros and Cons
• PROS
• Extreme application portability
• Very easy to create and work with derivative
• Fast boot on containers
• CONS
• Host-centric solution
• No higher-level provisioning
• No usage tracking/reporting
65. Kubernetes
• Open source orchestration system for Docker
containers
• Provide declarative primitives for the “desired state”
• Self-healing
• Auto-restarting
• Schedule across hosts
• Replicating
68. Concepts
• Pods: collocated group of
Docker containers that
share an IP and storage
volume
Docker
Pod 1 Pod 2
C1 C2 C3
69. Concepts
• Pods: collocated group of
Docker containers that
share an IP and storage
volume
• Service: Single, stable
name for a set of pods, also
acts as LB
Docker
Pod 1 Pod 2
C1 C2 C3
Pod 1
JBoss
Pod 2
JBoss
Service “web”
port 8080 port 8080
70. Concepts
• Pods: collocated group of
Docker containers that
share an IP and storage
volume
• Service: Single, stable
name for a set of pods, also
acts as LB
• Replication Controller:
manages the lifecycle of
pods and ensures specified
number are running
Docker
Pod 1 Pod 2
C1 C2 C3
Pod 1
JBoss
Pod 2
JBoss
Service “web”
port 8080 port 8080
71. Concepts
• Pods: collocated group of
Docker containers that
share an IP and storage
volume
• Service: Single, stable
name for a set of pods, also
acts as LB
• Replication Controller:
manages the lifecycle of
pods and ensures specified
number are running
• Label: used to organize
and select group of objects
Docker
Pod 1 Pod 2
C1 C2 C3
Pod 1
JBoss
Pod 2
JBoss
Service “web”
port 8080 port 8080
79. Recipe #2.1
Mac OS X
Kubernetes (Vagrant)
Master
Minion
Pod
Docker
(WildFly)
http://blog.arungupta.me/javaee7-wildfly-kubernetes-mac-vagrant/
80. Services
• Abstract a set of pods as a single IP and port
• Simple TCP/UDP load balancing
• Creates environment variables in other pods
• Like “Docker links” but across hosts
• Stable endpoint for pods to reference
• Allows list of pods to change dynamically
86. Replication Controller
• Ensures specified number of pod “replicas” are
running
• Pod templates are cookie cutters
• Rescheduling
87. Replication Controller
• Ensures specified number of pod “replicas” are
running
• Pod templates are cookie cutters
• Rescheduling
• Manual or auto-scale replicas
88. Replication Controller
• Ensures specified number of pod “replicas” are
running
• Pod templates are cookie cutters
• Rescheduling
• Manual or auto-scale replicas
• Rolling updates
91. Recipe #2.4
Minion 2
Minion 1
Pod
Docker
(WildFly)
Pod
Docker
(MySQL)
MySQL
Service
Pod
Docker
(WildFly)
WildFly
Service
92. Recipe #2.4
Minion 2
Minion 1
Pod
Docker
(WildFly)
Pod
Docker
(MySQL)
MySQL
Service
Pod
Docker
(WildFly)
WildFly
Service
93. Kubernetes: Pros and Cons
• PROS
• Manage related Docker containers as a unit
• Container communication across hosts
• Availability and scalability through automated deployment
and monitoring of pods and their replicas, across hosts
94. Kubernetes: Pros and Cons
• CONS
• Lifecycle of applications - build, deploy, manage, promote
• Port existing source code to run in Kubernetes
• DevOps: Dev -> Test -> Production
• No multi-tenancy
• On-premise (available on GCE)
• Assumes inter-pod networking as part of infrastructure
• Requires explicit load balancer
95. Pod 7
ActiveMQ
Pod 8
ActiveMQ
“mq”
port 8161 port 8161
Pod 1
Apache
Pod 2
Apache
“web”
port 80 port 80
Pod 5
MySQL
Pod 6
MySQL
“db”
port 3306 port 3306
Pod 3
JBoss
Pod 4
JBoss
“javaee”
port 8080 port 8080
96. Pod 7
ActiveMQ
Pod 8
ActiveMQ
“mq”
port 8161 port 8161
Pod 1
Apache
Pod 2
Apache
“web”
port 80 port 80
Pod 5
MySQL
Pod 6
MySQL
“db”
port 3306 port 3306
Pod 3
JBoss
Pod 4
JBoss
“javaee”
port 8080 port 8080
100. OpenShift 3 Features
• Push to production - full DevOps
• Client tools for building web applications
101. OpenShift 3 Features
• Push to production - full DevOps
• Client tools for building web applications
• Centralized administration and management of
application component libraries
102. OpenShift 3 Features
• Push to production - full DevOps
• Client tools for building web applications
• Centralized administration and management of
application component libraries
• Team and user isolation of containers, builds, and
network communication in an easy multi-tenancy
system
103. Recipe #3.1
• Start OpenShift as Docker container
• Or run natively
• Use osc (OpenShift Client) instead of kubectl
with Kubernetes configuration file
104. Recipe #3.2
• (Alpha) tools generate project JSON configuration
file that provide build/deployment
107. Summary
• Container runtime and image distribution
• Roll your own solutions for everything
• Runtime and operational management of containers
• Lifecycle of applications - build, deploy, manage, promote
• Manage tens of thousands of applications with teams