SlideShare a Scribd company logo
Docker Distributed
Application Bundle &
Stack
20th Aug 2016, Docker Bangalore Meetup,
RedHat India Pvt. Ltd.
Thomas Chacko
thomasch (at ) iconnexions.com
Distributed Application Bundle & Stack
Advisory: The functionality described here is marked as experimental, and as such, may
change before it becomes GA.
• Real-world applications are complex - codebases, stacks, databases, queues,
networks..
• Deploy and managing using docker compose and service to start/stop and link
individual containers / service not efficient within production environment
• Introducing DAB :: Experimental open file format to bundle and distribute all
artefacts for a real-world multi-container, multi-host, multi-tiered networked
applications
• High level abstraction - leverages all new features of Docker 1.12 ( swarm - orchestration &
load balancing, services, nodes etc ).
• DAB describes ( JSON ) :
• all services required
• images
• ports to expose
• networks used to link services
• etc…
Distributed Application Bundle & Stack
• Requires docker-compose 1.8 and docker 1.12. Developers use docker-compose to
create DABs and Ops deploys these stacks using docker.
• Image is a portable format for a single container file

• Distributed Application Bundle or DAB is a light-weight portable format for multiple
containers. Each bundle can be deployed as a Stack at run-time in production.
DAB in action - demo
Front End Back End
• Python webapp which lets you vote
between several options

• Node.js /AngularJS webapp showing
the results of the poll in real time
• Redis Queue to collect new votes

• Java Worker which consumes
votes and stores them in the
database

• Postgres database backed by a
Docker Volume
related command synopsis
$	docker-compose	bundle	--help	
Generate	 a	 Distributed	 Application	 Bundle	 (DAB)	 from	 the	 Compose	 file	 .	 Images	 must	 have	 digests	 stored,	 which	 requires	
interaction	with	a	Docker	registry.	If	digests	aren't	stored	for	all	images,	you	can	fetch	them	with	`docker-compose	pull`	or	`docker-
compose	push`.	To	push	images	automatically	when	bundling,	pass	`--push-images`.	Only	services	with	a	`build`	option	specified	will	
have	their	images	pushed.	
Usage:	bundle	[options]	
Options:	
		--push-images										Automatically	push	images	for	any	services	
																																			which	have	a	`build`	option	specified.	
				-o,	--output	PATH		Path	to	write	the	bundle	file	to.	
																																			Defaults	to	"<project	name>.dab”.	
$	docker	deploy	--help	
Usage:		 docker	deploy	[OPTIONS]	STACK	
Create	and	update	a	stack	from	a	Distributed	Application	Bundle	(DAB)	
Options:	
			--file	string																				Path	to	a	Distributed	Application	Bundle	file	(Default:	STACK.dab)	
					--help																													Print	usage	
					--with-registry-auth				Send	registry	authentication	details	to	Swarm	agents
related command synopsis..cont
$	docker	stack	--help	
Usage:		 docker	stack	COMMAND	
Manage	Docker	stacks	
Options:	
						--help			Print	usage	
Commands:	
		config						Print	the	stack	configuration	
		deploy					Create	and	update	a	stack	from	a	Distributed	Application	Bundle	(DAB)	
		rm												Remove	the	stack	
		ps													List	the	tasks	in	the	stack
Docker Compose vs DAB
• Docker Compose is a client side tool presently used in development / test workflow
• Docker DAB is ( specifically intended ) to be used at scale and server side orchestration
within production environment. Bundle deployment is an integral function of docker 1.12
engine. Stack can be deployed on a docker 1.12 swarm cluster only.
• DAB can deploy non-containerised app also.
• more (?)
Playbook : swarm/dab local test setup 1/4
• Pre-requisite : one Host PC or laptop : Windows 7+, MacOS X 10.11+, any modern Linux
with 3.10+ kernel ( recommended, Redhat/Centos/Ubuntu) with min 4GB ( 8GB
recomended) RAM and 20GB free hard disk.
• For Windows and OSX, one can install docker toolbox from https://docs.docker.com/
toolbox/overview/. Additionally can install docker for windows or OSX client also. For
Linux, install latest docker ver 1.12+ client /server , compose 1.8 from https://
docs.docker.com/engine/getstarted/step_one/ . Docker toolbox on OSX and Windows also
installs Oracle Virtualbox ; for Linux install it from https://www.virtualbox.org/wiki/
Downloads
• Create a docker hub/cloud login account ( https://cloud.docker.com/ - req only if one wish
to build custom images and push/pull from docker hub repository)
• Now we are ready to setup nodes and a swarm cluster on it
• Note : This playbook is for local VM setup. One can alternatively spin up machines on any
public cloud and follow this guide accordingly.
We will setup a simple 3 node swarm with 1 leader (master ) using docker-machine
Create the nodes :
$ docker-machine create -d virtualbox master
$ docker-machine create -d virtualbox node-1
$ docker-machine create -d virtualbox node-2
Inspect/configure the VM nodes created :
$ docker-machine ls
Note : VirtualBox will generally provision 2 networks : one NAT for internet and one Host-only networking whose IP will be
dynamically allotted with each reboots. This changing DHCP IP allocation will break our docker PKI and swarm config on
node reboots and hence the workaround presently is a tweak script here which can make this IP static ( Ref : https://
github.com/fivestars/docker-machine-ipconfig). Immediately after the VMs are created and docker provisioned - use the
above docker-machine-ipconfig cmd and make these ips static. The other option is to bypass docker-machine and instead
directly use vagrant/puppet/chef scripts with fixed ip declaration.
Recommended ( not mandatory ) - Add the ip address for all 3 nodes from ‘docker-machine ls’ cmd above to /etc/hosts on
the host OS machine. This playbook assumes such and refers nodes with their host name here viz. ( master , node-1 ,
node-2 ). Recommended to edit VM settings and set all the 3 node VMs memory to 1GB (min, recomended 2GB) each.
Roll out the swarm cluster network :
(Optional ) If docker for Windows or OSX client was also installed, then we need to point this local docker client to the
Docker engine on master node by setting DOCKER_* environment variables using :
$ eval $( docker-machine env master )
Lets initialise the swarm network on master node.
$ docker-machine ssh master
master $ docker swarm init — listen-addr=192.168.99.103:2733 —advertise-addr=192.168.99.103:2733
The - - advertise-addr above is required because of 2 network interface on these VMs. Substitute 192.168.99.103 above
with your master node ip from ‘docker-machine ls’. The above command will return an URL with a swarm token string to be
run on each worker nodes. SSH to each worker nodes and copy/paste this command on it
$ docker-machine ssh node-1
node-1 $ ( copy/paste the above join command here )
repeat above for node-2. The docker swarm cluster is setup .
Checkout the Docker swarm cluster members . PS: all commands further down are assumed to be run against master node.
$ docker node ls
This will show the three nodes with the elected leader node(s) tagged.
Playbook : swarm/dab test-setup 2/4
Test setup the classic voting app ( thanks to Docker )
Option -1 Download/ build the images required for this Docker playbook
$ git clone https://github.com/docker/example-voting-app.git
$ cd example-voting-app
There are 5 services , one can modify the script to change the poll options etc. refer git read me.
$ cd vote
$ docker build --no-cache -t thomasch/votingapp_voting-app .
{ replace thomasch here in all the image name(s) with your docker-hub id or name }
$ cd worker
$ docker build --no-cache -t thomasch/votingapp_worker .
$ cd result
$ docker build --no-cache -t thomasch/votingapp_result-app .
We will push these images to docker repository ( also create image digest )
$ docker login
{ provide docker hub/cloud username and password when prompted }
$ docker push thomasch/votingapp_voting-app
$ docker push thomasch/votingapp_worker
$ docker push thomasch/votingapp_result-app
{ use corrected docker image names above }
Option-2 OR ALTERNATIVELY instead of Option-1 , [ only if you trust them :) ] - you can pull these images directly
from my docker public repository
$ docker pull thomasch/votingapp_voting-app
$ docker pull thomasch/votingapp_worker
$ docker pull thomasch/votingapp_result-app
Inspect the docker-compose.yml file in the example-voting-app folder. This file has to be slightly modified to be dab
conversion compatible . Check/download the final edited version here :
https://gist.github.com/thomgit/c0ddfcded35f986055e391442c83bda9
Copy this yml file to a new directory. Review and update the images names if you have changed them during custom
build above in Option-1.
Playbook : swarm/dab test-build 3/4
Convert the compose YAML to DAB format and test stack and swarm workflow
cd to the directory with modified docker-compose.yml file and covert this to .DAB format
first pull the remaining images required for this voting app from public repository - redis, postgres
$ docker-compose pull vote, redis, worker , db, result
convert the docker-compose yaml file to JSON dab format using docker-compose client tool ( >ver 1.8 )
$ docker-compose bundle -o votingapp.dab.
deploy this dab file on the swarm cluster we setup
$ docker deploy votingapp
This will deploy 5 services - it might take time for all the 5 services to start. Check the stack services status using
$ docker stack ps votingapp
Inspect the ‘PublishedPort’ for votingapp_vote and votingapp_result. These port(s) should be in 30000+ range.
$ docker service inspect votingapp_vote --pretty
$ docker service inspect votingapp_result --pretty
The voting and results front-end will be available in the host machine browser on any ( swarm mesh network feature ) node
cluster ip address ( e.g. http://192.168.99.xx: <PublshedPort> ). Test the vote page and see the real-time poll results
displayed by the node.js/AngularJS result app page.
We have stood-up an entire application stack now . The new ‘docker stack’ CLI can be used to manage all the services
together in this stack:
check the stack configuration
$ docker stack config votingapp
delete the entire stack
$ docker stack rm votingapp
Additional suggested activity
Use this docker swarm cluster to :
• test scale-up/down the votingapp_vote service
• drain any one node and see how swarm reschedules the services to other node(s) to maintain the desired state of stack
• create a new version of votingapp_vote_v2 and check out rolling upgrades.
Hope this help get a reasonable grip on these exciting new docker 1.12 features...
Playbook : swarm/dab test-run 3/4

More Related Content

What's hot

Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor BrownDockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Docker, Inc.
 
Docker Swarm & Machine
Docker Swarm & MachineDocker Swarm & Machine
Docker Swarm & Machine
Eueung Mulyana
 
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16 What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
Docker, Inc.
 
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Nils De Moor
 
Deep Dive into Docker Swarm Mode
Deep Dive into Docker Swarm ModeDeep Dive into Docker Swarm Mode
Deep Dive into Docker Swarm Mode
Ajeet Singh Raina
 
Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...
Docker, Inc.
 
CoreOS Overview and Current Status
CoreOS Overview and Current StatusCoreOS Overview and Current Status
CoreOS Overview and Current Status
Sreenivas Makam
 
Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017
Chris Tankersley
 
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Docker, Inc.
 
Docker Overview
Docker OverviewDocker Overview
Docker Overview
Rohit Jnagal
 
Ansible docker
Ansible dockerAnsible docker
Ansible docker
QNIB Solutions
 
Monitoring Dell Infrastructure using Docker & Microservices
Monitoring Dell Infrastructure using Docker & MicroservicesMonitoring Dell Infrastructure using Docker & Microservices
Monitoring Dell Infrastructure using Docker & Microservices
Ajeet Singh Raina
 
Comprehensive Monitoring for Docker
Comprehensive Monitoring for DockerComprehensive Monitoring for Docker
Comprehensive Monitoring for Docker
Christian Beedgen
 
Containers: The What, Why, and How
Containers: The What, Why, and HowContainers: The What, Why, and How
Containers: The What, Why, and How
Sneha Inguva
 
Cloning Running Servers with Docker and CRIU by Ross Boucher
Cloning Running Servers with Docker and CRIU by Ross BoucherCloning Running Servers with Docker and CRIU by Ross Boucher
Cloning Running Servers with Docker and CRIU by Ross Boucher
Docker, Inc.
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
Sreenivas Makam
 
Building Reusable Development Environments with Docker
Building Reusable Development Environments with DockerBuilding Reusable Development Environments with Docker
Building Reusable Development Environments with Docker
Revelation Technologies
 
Docker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notesDocker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notes
Sreenivas Makam
 
Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker Compose
Justin Crown
 
Under the Hood with Docker Swarm Mode - Drew Erny and Nishant Totla, Docker
Under the Hood with Docker Swarm Mode - Drew Erny and Nishant Totla, DockerUnder the Hood with Docker Swarm Mode - Drew Erny and Nishant Totla, Docker
Under the Hood with Docker Swarm Mode - Drew Erny and Nishant Totla, Docker
Docker, Inc.
 

What's hot (20)

Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor BrownDockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
 
Docker Swarm & Machine
Docker Swarm & MachineDocker Swarm & Machine
Docker Swarm & Machine
 
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16 What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
What's New in Docker 1.12 by Nishant Totla for Docker SF Meetup 08.03.16
 
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
Dockercon 16 Wrap-up (Docker for Mac and Win, Docker 1.12, Swarm Mode, etc.)
 
Deep Dive into Docker Swarm Mode
Deep Dive into Docker Swarm ModeDeep Dive into Docker Swarm Mode
Deep Dive into Docker Swarm Mode
 
Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...Online Meetup: Why should container system / platform builders care about con...
Online Meetup: Why should container system / platform builders care about con...
 
CoreOS Overview and Current Status
CoreOS Overview and Current StatusCoreOS Overview and Current Status
CoreOS Overview and Current Status
 
Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017
 
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
 
Docker Overview
Docker OverviewDocker Overview
Docker Overview
 
Ansible docker
Ansible dockerAnsible docker
Ansible docker
 
Monitoring Dell Infrastructure using Docker & Microservices
Monitoring Dell Infrastructure using Docker & MicroservicesMonitoring Dell Infrastructure using Docker & Microservices
Monitoring Dell Infrastructure using Docker & Microservices
 
Comprehensive Monitoring for Docker
Comprehensive Monitoring for DockerComprehensive Monitoring for Docker
Comprehensive Monitoring for Docker
 
Containers: The What, Why, and How
Containers: The What, Why, and HowContainers: The What, Why, and How
Containers: The What, Why, and How
 
Cloning Running Servers with Docker and CRIU by Ross Boucher
Cloning Running Servers with Docker and CRIU by Ross BoucherCloning Running Servers with Docker and CRIU by Ross Boucher
Cloning Running Servers with Docker and CRIU by Ross Boucher
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
Building Reusable Development Environments with Docker
Building Reusable Development Environments with DockerBuilding Reusable Development Environments with Docker
Building Reusable Development Environments with Docker
 
Docker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notesDocker Mentorweek beginner workshop notes
Docker Mentorweek beginner workshop notes
 
Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker Compose
 
Under the Hood with Docker Swarm Mode - Drew Erny and Nishant Totla, Docker
Under the Hood with Docker Swarm Mode - Drew Erny and Nishant Totla, DockerUnder the Hood with Docker Swarm Mode - Drew Erny and Nishant Totla, Docker
Under the Hood with Docker Swarm Mode - Drew Erny and Nishant Totla, Docker
 

Similar to Docker Distributed application bundle & Stack - Overview

Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020
CloudHero
 
Docker Compose Explained
Docker Compose ExplainedDocker Compose Explained
Docker Compose Explained
Shawn Sorichetti
 
Docker advance topic
Docker advance topicDocker advance topic
Docker advance topic
Kalkey
 
Docker advance1
Docker advance1Docker advance1
Docker advance1
Gourav Varma
 
Intersog Hack_n_Tell. Docker. First steps.
Intersog Hack_n_Tell. Docker. First steps.Intersog Hack_n_Tell. Docker. First steps.
Intersog Hack_n_Tell. Docker. First steps.
Intersog
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
PROIDEA
 
Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112
Nirmal Mehta
 
Online Meetup: What's new in docker 1.13.0
Online Meetup: What's new in docker 1.13.0 Online Meetup: What's new in docker 1.13.0
Online Meetup: What's new in docker 1.13.0
Docker, Inc.
 
Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2
Binary Studio
 
DCEU 18: Developing with Docker Containers
DCEU 18: Developing with Docker ContainersDCEU 18: Developing with Docker Containers
DCEU 18: Developing with Docker Containers
Docker, Inc.
 
Tips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podmanTips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podman
Thierry Gayet
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
Runcy Oommen
 
Be a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the tradeBe a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the trade
Nicola Paolucci
 
Effective images remix
Effective images remixEffective images remix
Effective images remix
🎥 Brent Langston
 
Docker Basic to Advance
Docker Basic to AdvanceDocker Basic to Advance
Docker Basic to Advance
Paras Jain
 
Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 3Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 3
Binary Studio
 
Be a Happier Developer with Docker: Tricks of the Trade
Be a Happier Developer with Docker: Tricks of the TradeBe a Happier Developer with Docker: Tricks of the Trade
Be a Happier Developer with Docker: Tricks of the Trade
Docker, Inc.
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
Alper Kanat
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
Tharaka Devinda
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
Binary Studio
 

Similar to Docker Distributed application bundle & Stack - Overview (20)

Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020
 
Docker Compose Explained
Docker Compose ExplainedDocker Compose Explained
Docker Compose Explained
 
Docker advance topic
Docker advance topicDocker advance topic
Docker advance topic
 
Docker advance1
Docker advance1Docker advance1
Docker advance1
 
Intersog Hack_n_Tell. Docker. First steps.
Intersog Hack_n_Tell. Docker. First steps.Intersog Hack_n_Tell. Docker. First steps.
Intersog Hack_n_Tell. Docker. First steps.
 
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz LachJDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
JDO 2019: Tips and Tricks from Docker Captain - Łukasz Lach
 
Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112Nats meetup oct 2016 docker 112
Nats meetup oct 2016 docker 112
 
Online Meetup: What's new in docker 1.13.0
Online Meetup: What's new in docker 1.13.0 Online Meetup: What's new in docker 1.13.0
Online Meetup: What's new in docker 1.13.0
 
Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2Academy PRO: Docker. Lecture 2
Academy PRO: Docker. Lecture 2
 
DCEU 18: Developing with Docker Containers
DCEU 18: Developing with Docker ContainersDCEU 18: Developing with Docker Containers
DCEU 18: Developing with Docker Containers
 
Tips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podmanTips pour sécuriser ses conteneurs docker/podman
Tips pour sécuriser ses conteneurs docker/podman
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
 
Be a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the tradeBe a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the trade
 
Effective images remix
Effective images remixEffective images remix
Effective images remix
 
Docker Basic to Advance
Docker Basic to AdvanceDocker Basic to Advance
Docker Basic to Advance
 
Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 3Academy PRO: Docker. Lecture 3
Academy PRO: Docker. Lecture 3
 
Be a Happier Developer with Docker: Tricks of the Trade
Be a Happier Developer with Docker: Tricks of the TradeBe a Happier Developer with Docker: Tricks of the Trade
Be a Happier Developer with Docker: Tricks of the Trade
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2Academy PRO: Docker. Part 2
Academy PRO: Docker. Part 2
 

Recently uploaded

Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - MydbopsMySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
Mydbops
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
LizaNolte
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Fwdays
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
From Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMsFrom Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMs
Sease
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
christinelarrosa
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
HarpalGohil4
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Ukraine
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
DianaGray10
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
ScyllaDB
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 

Recently uploaded (20)

Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - MydbopsMySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
 
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham HillinQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
inQuba Webinar Mastering Customer Journey Management with Dr Graham Hill
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
From Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMsFrom Natural Language to Structured Solr Queries using LLMs
From Natural Language to Structured Solr Queries using LLMs
 
Christine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptxChristine's Supplier Sourcing Presentaion.pptx
Christine's Supplier Sourcing Presentaion.pptx
 
AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)AWS Certified Solutions Architect Associate (SAA-C03)
AWS Certified Solutions Architect Associate (SAA-C03)
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
GlobalLogic Java Community Webinar #18 “How to Improve Web Application Perfor...
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
What is an RPA CoE? Session 2 – CoE Roles
What is an RPA CoE?  Session 2 – CoE RolesWhat is an RPA CoE?  Session 2 – CoE Roles
What is an RPA CoE? Session 2 – CoE Roles
 
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's TipsGetting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
Getting the Most Out of ScyllaDB Monitoring: ShareChat's Tips
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 

Docker Distributed application bundle & Stack - Overview

  • 1. Docker Distributed Application Bundle & Stack 20th Aug 2016, Docker Bangalore Meetup, RedHat India Pvt. Ltd. Thomas Chacko thomasch (at ) iconnexions.com
  • 2. Distributed Application Bundle & Stack Advisory: The functionality described here is marked as experimental, and as such, may change before it becomes GA. • Real-world applications are complex - codebases, stacks, databases, queues, networks.. • Deploy and managing using docker compose and service to start/stop and link individual containers / service not efficient within production environment • Introducing DAB :: Experimental open file format to bundle and distribute all artefacts for a real-world multi-container, multi-host, multi-tiered networked applications • High level abstraction - leverages all new features of Docker 1.12 ( swarm - orchestration & load balancing, services, nodes etc ). • DAB describes ( JSON ) : • all services required • images • ports to expose • networks used to link services • etc…
  • 3. Distributed Application Bundle & Stack • Requires docker-compose 1.8 and docker 1.12. Developers use docker-compose to create DABs and Ops deploys these stacks using docker. • Image is a portable format for a single container file
 • Distributed Application Bundle or DAB is a light-weight portable format for multiple containers. Each bundle can be deployed as a Stack at run-time in production.
  • 4. DAB in action - demo Front End Back End • Python webapp which lets you vote between several options • Node.js /AngularJS webapp showing the results of the poll in real time • Redis Queue to collect new votes • Java Worker which consumes votes and stores them in the database • Postgres database backed by a Docker Volume
  • 5. related command synopsis $ docker-compose bundle --help Generate a Distributed Application Bundle (DAB) from the Compose file . Images must have digests stored, which requires interaction with a Docker registry. If digests aren't stored for all images, you can fetch them with `docker-compose pull` or `docker- compose push`. To push images automatically when bundling, pass `--push-images`. Only services with a `build` option specified will have their images pushed. Usage: bundle [options] Options: --push-images Automatically push images for any services which have a `build` option specified. -o, --output PATH Path to write the bundle file to. Defaults to "<project name>.dab”. $ docker deploy --help Usage: docker deploy [OPTIONS] STACK Create and update a stack from a Distributed Application Bundle (DAB) Options: --file string Path to a Distributed Application Bundle file (Default: STACK.dab) --help Print usage --with-registry-auth Send registry authentication details to Swarm agents
  • 6. related command synopsis..cont $ docker stack --help Usage: docker stack COMMAND Manage Docker stacks Options: --help Print usage Commands: config Print the stack configuration deploy Create and update a stack from a Distributed Application Bundle (DAB) rm Remove the stack ps List the tasks in the stack
  • 7. Docker Compose vs DAB • Docker Compose is a client side tool presently used in development / test workflow • Docker DAB is ( specifically intended ) to be used at scale and server side orchestration within production environment. Bundle deployment is an integral function of docker 1.12 engine. Stack can be deployed on a docker 1.12 swarm cluster only. • DAB can deploy non-containerised app also. • more (?)
  • 8. Playbook : swarm/dab local test setup 1/4 • Pre-requisite : one Host PC or laptop : Windows 7+, MacOS X 10.11+, any modern Linux with 3.10+ kernel ( recommended, Redhat/Centos/Ubuntu) with min 4GB ( 8GB recomended) RAM and 20GB free hard disk. • For Windows and OSX, one can install docker toolbox from https://docs.docker.com/ toolbox/overview/. Additionally can install docker for windows or OSX client also. For Linux, install latest docker ver 1.12+ client /server , compose 1.8 from https:// docs.docker.com/engine/getstarted/step_one/ . Docker toolbox on OSX and Windows also installs Oracle Virtualbox ; for Linux install it from https://www.virtualbox.org/wiki/ Downloads • Create a docker hub/cloud login account ( https://cloud.docker.com/ - req only if one wish to build custom images and push/pull from docker hub repository) • Now we are ready to setup nodes and a swarm cluster on it • Note : This playbook is for local VM setup. One can alternatively spin up machines on any public cloud and follow this guide accordingly.
  • 9. We will setup a simple 3 node swarm with 1 leader (master ) using docker-machine Create the nodes : $ docker-machine create -d virtualbox master $ docker-machine create -d virtualbox node-1 $ docker-machine create -d virtualbox node-2 Inspect/configure the VM nodes created : $ docker-machine ls Note : VirtualBox will generally provision 2 networks : one NAT for internet and one Host-only networking whose IP will be dynamically allotted with each reboots. This changing DHCP IP allocation will break our docker PKI and swarm config on node reboots and hence the workaround presently is a tweak script here which can make this IP static ( Ref : https:// github.com/fivestars/docker-machine-ipconfig). Immediately after the VMs are created and docker provisioned - use the above docker-machine-ipconfig cmd and make these ips static. The other option is to bypass docker-machine and instead directly use vagrant/puppet/chef scripts with fixed ip declaration. Recommended ( not mandatory ) - Add the ip address for all 3 nodes from ‘docker-machine ls’ cmd above to /etc/hosts on the host OS machine. This playbook assumes such and refers nodes with their host name here viz. ( master , node-1 , node-2 ). Recommended to edit VM settings and set all the 3 node VMs memory to 1GB (min, recomended 2GB) each. Roll out the swarm cluster network : (Optional ) If docker for Windows or OSX client was also installed, then we need to point this local docker client to the Docker engine on master node by setting DOCKER_* environment variables using : $ eval $( docker-machine env master ) Lets initialise the swarm network on master node. $ docker-machine ssh master master $ docker swarm init — listen-addr=192.168.99.103:2733 —advertise-addr=192.168.99.103:2733 The - - advertise-addr above is required because of 2 network interface on these VMs. Substitute 192.168.99.103 above with your master node ip from ‘docker-machine ls’. The above command will return an URL with a swarm token string to be run on each worker nodes. SSH to each worker nodes and copy/paste this command on it $ docker-machine ssh node-1 node-1 $ ( copy/paste the above join command here ) repeat above for node-2. The docker swarm cluster is setup . Checkout the Docker swarm cluster members . PS: all commands further down are assumed to be run against master node. $ docker node ls This will show the three nodes with the elected leader node(s) tagged. Playbook : swarm/dab test-setup 2/4
  • 10. Test setup the classic voting app ( thanks to Docker ) Option -1 Download/ build the images required for this Docker playbook $ git clone https://github.com/docker/example-voting-app.git $ cd example-voting-app There are 5 services , one can modify the script to change the poll options etc. refer git read me. $ cd vote $ docker build --no-cache -t thomasch/votingapp_voting-app . { replace thomasch here in all the image name(s) with your docker-hub id or name } $ cd worker $ docker build --no-cache -t thomasch/votingapp_worker . $ cd result $ docker build --no-cache -t thomasch/votingapp_result-app . We will push these images to docker repository ( also create image digest ) $ docker login { provide docker hub/cloud username and password when prompted } $ docker push thomasch/votingapp_voting-app $ docker push thomasch/votingapp_worker $ docker push thomasch/votingapp_result-app { use corrected docker image names above } Option-2 OR ALTERNATIVELY instead of Option-1 , [ only if you trust them :) ] - you can pull these images directly from my docker public repository $ docker pull thomasch/votingapp_voting-app $ docker pull thomasch/votingapp_worker $ docker pull thomasch/votingapp_result-app Inspect the docker-compose.yml file in the example-voting-app folder. This file has to be slightly modified to be dab conversion compatible . Check/download the final edited version here : https://gist.github.com/thomgit/c0ddfcded35f986055e391442c83bda9 Copy this yml file to a new directory. Review and update the images names if you have changed them during custom build above in Option-1. Playbook : swarm/dab test-build 3/4
  • 11. Convert the compose YAML to DAB format and test stack and swarm workflow cd to the directory with modified docker-compose.yml file and covert this to .DAB format first pull the remaining images required for this voting app from public repository - redis, postgres $ docker-compose pull vote, redis, worker , db, result convert the docker-compose yaml file to JSON dab format using docker-compose client tool ( >ver 1.8 ) $ docker-compose bundle -o votingapp.dab. deploy this dab file on the swarm cluster we setup $ docker deploy votingapp This will deploy 5 services - it might take time for all the 5 services to start. Check the stack services status using $ docker stack ps votingapp Inspect the ‘PublishedPort’ for votingapp_vote and votingapp_result. These port(s) should be in 30000+ range. $ docker service inspect votingapp_vote --pretty $ docker service inspect votingapp_result --pretty The voting and results front-end will be available in the host machine browser on any ( swarm mesh network feature ) node cluster ip address ( e.g. http://192.168.99.xx: <PublshedPort> ). Test the vote page and see the real-time poll results displayed by the node.js/AngularJS result app page. We have stood-up an entire application stack now . The new ‘docker stack’ CLI can be used to manage all the services together in this stack: check the stack configuration $ docker stack config votingapp delete the entire stack $ docker stack rm votingapp Additional suggested activity Use this docker swarm cluster to : • test scale-up/down the votingapp_vote service • drain any one node and see how swarm reschedules the services to other node(s) to maintain the desired state of stack • create a new version of votingapp_vote_v2 and check out rolling upgrades. Hope this help get a reasonable grip on these exciting new docker 1.12 features... Playbook : swarm/dab test-run 3/4