SlideShare a Scribd company logo
BUTTER BEI DIE FISCHE
Ein Jahr Entwicklung und Produktion mit Docker
Johannes Unterstein und Patrick Busch
AGENDA
How can we make a single tenant system suitable
for multitenancy and scalable without changing the
whole system?
AGENDA
• Introduction
• Dockerizing the Application
• Dockerizing the Infrastructure
• Best Practices
• Lessons Learned
INTRODUCTION
• One existing application
• Have it available for several different legal entities
• No way to implement multitenancy the existing
application
INTRODUCTION
SOAP
SQL
STORED
PROCEDURES
NO CACHING
flens/web
flens/burg
flens/db
INTRODUCTION
SOAP
SQL
STORED
PROCEDURES
NO CACHING
SOAP
SQL
STORED
PROCEDURES
NO CACHING
SOAP
SQL
STORED
PROCEDURES
NO CACHING
etc.
PROXY
A B C
DOCKERIZINGTHE
APPLICATION
VARIANT 1
VARIANT 1
• Pros
• Easy to understand/build/run/host
• Cons
• Separation
• Scalability
• Updates
VARIANT 2
VARIANT 2
• Pros
• Scalability
• Separation
• Updates
• Cons
• Advanced connection between containers needed
VARIANT 2
• Connection between containers
• Not via docker linkage
• Via /etc/host entry and environment variable
• Interpreting startup shell script in container
VARIANT 2
docker run -dP --env
flensburgHost=someHost --env
flensburgPort=1234 flens/web:1.23
DOCKERIZINGTHE
INFRASTRUCTURE
VARIANT A
VARIANT A
FRONTEND
MW/MANAGER
REGISTRY
EXECUTOR
VARIANT A
FRONTEND
MW/MANAGER
REGISTRY
EXECUTOR
builds the image
stores the image
runs the container
VARIANT A
• Classic approach
• Running applications on the metal
• Physical servers, each needs to be configured for the
application
• One server that runs the application containers
VARIANT B
VARIANT B
• More flexibility
• Every physical server is basically the same
• Installation done via script in a few minutes each
• Containers can then be run on any server
• Images contain all the needed configuration
VARIANT C
VARIANT C
*n
VARIANT C
• Multiple servers for the application containers
• Better load distribution
• Improved security
VARIANT D
PROXY
*n
PROXY
PROXY ?
FIREWALL
FIREWALL
FIREWALL
VARIANT D
• Configure containers to point to proxies
• Proxies manage certificates
• Proxies pass through containers
• Allows multiple containers per system to run in
parallel while they can be addressed on their own
FULL SCALE
*n
BUILD
IMAGES
PROXY
PROXYFIREWALL
FIREWALL
FIREWALL
FULL SCALE
*n
BUILD
IMAGES
STORE
IMAGES
PUSH
PROXY
PROXYFIREWALL
FIREWALL
FIREWALL
RUN
CONTAINERS
FULL SCALE
*n
BUILD
IMAGES
STORE
IMAGES
PUSH
PULL
*n
*n
*n
PROXY
PROXYFIREWALL
FIREWALL
FIREWALL
ADDED BENEFITS
• Self Service
• Flexibility
• Scalability
• Security
• A/B-Switching
STAGING
*n
PUSH
PULL
*n
PUSH
PULL
PRODUCTION STAGE
STAGING
*n
PUSH
PULL
*n
PUSH
PULL
PRODUCTION STAGE
SHARED REGISTRY FOR
INFRASTRUCTURE IMAGES
STAGING
• Easily duplicated environment
• Use docker registry for infrastructure images
• Release versioned images
• Script checks that versions cannot be overwritten
• Stage first approach
BEST PRACTICES
COMMON BASE IMAGES
• Common stuff in common base image
• As much as possible in base image
• Define versions of tools explicitly
• Lowers registry size
GROUP COMMANDS
• Try to combine commands with „&&“
• Less intermediate containers
• Increases build performance
• Lowers registry size
GROUP COMMANDS
RUN chmod u+x /home/app/start.sh
RUN chown app:app /home/app/start.sh
GROUP COMMANDS
RUN chmod u+x /home/app/start.sh && 
chown app:app /home/app/start.sh
ORDER COMMANDS
• Stable commands as early as possible
• ADD commands as late as possible
• Caching increases build performance
• Lowers registry size
USE SCRIPTS
docker run -d 
--read-only 
-p 127.0.0.1:30022:22 
-p 127.0.0.1:38080:8080 
-v /docker/data/nginx:/var/lib/nginx 
-v /docker/logs/nginx:/var/log/nginx 
-v /docker/tmp:/tmp 
-v /docker/run:/var/run 
--name flens_web 
repository_host_name:8888/flens/web:1.0
USE SCRIPTS
flens web run 1.0
USE SCRIPTS
• Running containers can be complicated on the
console
• Scripts can improve readability and memorability
• Improved speed and less failures
• Reusability
BUILD CONTINUOUS
• Use scripts in continuous integration server as well
• We use „Execute shell command“ jobs
• e.g.: flens web build && flens web rerun
USE PROXIES
• Proxy on the physical machines (e.g. nginx)
• Containers listen only to localhost device
• Nginx handles incoming requests and passes on
• Nginx handles security
• More than one container of a given type
• By symlinking nginx config files you can switch from one slot to another
USEVOLUMES
• Volumes are directories mounted from the
physical host
• Files in a volume are visible from inside the
container (and writeable)
• Useful for logging, syncing data, etc…
READ-ONLY CONTAINERS
• A read only container cannot write to its own file system
• Can only write to volumes
• Perfectly immutable containers are easily interchangable!
• Build and distribute containers even more freely
• No unexpected states, defined income -> defined outcome
MAKEYOUR CONTAINERS
FLEXIBLE
• Use /etc/hosts defined hostnames instead of IP
addresses
• Use environment variables at startup (--env)
LESSONS LEARNED
QUIRKS OF DOCKERFILES
• COPY vs ADD
• ADD can be a URL,ADD extracts tar.gz files automatically
• ENTRYPOINT vs CMD
• CMD can be overwritten at startup, ENTRYPOINT cannot
• Both are possible in a single Dockerfile
• ENTRYPOINT/CMD syntax
• determines if the executable is started directly or in a shell
QUIRKS OF DOCKERFILES
• COPY vs ADD
• ADD can be a URL,ADD extracts tar.gz files automatically
• ENTRYPOINT vs CMD
• CMD can be overwritten at startup, ENTRYPOINT cannot
• Both are possible in a single Dockerfile - this combines them!
• ENTRYPOINT/CMD syntax
• determines if the executable is started directly or in a shell
CMD AND ENTRYPOINT
CMD ping localhost
=> /bin/sh -c ‘ping localhost’
CMD[“ping”,”localhost”]
=> ping localhost
ENTRYPOINT[“ping”]
CMD [“localhost”]
=> ping localhost
$ docker run container_name www.flens.de
=> ping www.flens.de
TRUSTYOUR OWN SKILLS
• Young technology, many tutorials, everybody else
knows it better
• Linking is fine, but not for us
• Configuring /etc/hosts at startup works wonders
• Try to use your own solution
DON’T USE LINKAGE
• Not possible over real machine boundaries
• Often leads to problems during startup
• Use /etc/hosts and environment parameters
DOCKER IN DOCKER
• Our infrastructure builds docker images
dynamically
• Our infrastructure is dockerized
• Do we need „docker in docker?“
DOCKER IN DOCKER
•Docker in docker is possible
• docker run -- privileged flens/mw:1.23
•Container runs inside flens/mw
•Problems during update of outer app
DOCKER IN DOCKER
•We used client/server docker communication
•Client = flens/mw
•Server = Docker of host system
•Similar to boot2docker
•All container runs on host system
IT’S CHEAPER
• We can use off the shelf servers
• We can use virtualized servers
• We can distribute easily over different server
providers
• Easily scalable
IT’S BETTER
• Release on touch of a button
• Deployment on touch of a button
• Transparent versioning of all apps
• Transparency of OS environment running the apps
• Environment is now part of dev process and versionable
THANKS
Cheers

More Related Content

PDF
SF DevOps: Introducing Vagrant
PPTX
Docker introduction
PDF
Nodejs OC Docker and Node
PDF
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia
PDF
Microservices: How loose is loosely coupled?
PPTX
Virtual Container - Docker
PPTX
Docker introduction
PPT
Docker introduction
SF DevOps: Introducing Vagrant
Docker introduction
Nodejs OC Docker and Node
From Zero Docker to Hackathon Winner - Marcos Lilljedahl and Jimena Tapia
Microservices: How loose is loosely coupled?
Virtual Container - Docker
Docker introduction
Docker introduction

What's hot (20)

PDF
The Three Musketeers
PPTX
Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose
PDF
Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov
PDF
Making Developers Productive with Vagrant, VirtualBox, and Docker
PPTX
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
PPTX
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
PPTX
Docker and stuff
PDF
Vagrant For DevOps
PPTX
Getting started with Docker
PDF
Introduction to Docker
PDF
DockerCon SF 2015: Orchestration for Sysadmins
PDF
Dockerizing your applications - Docker workshop @Twitter
PDF
Docker worshop @Twitter - How to use your own private registry
PDF
Docker Introduction
PDF
Docker 101 - Getting started
PPTX
Docker: From Zero to Hero
PPTX
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
PDF
Introduction to docker
PPTX
Docker Basics
PPTX
Docker lxc win
The Three Musketeers
Containers #101 : Docker ONBUILD triggers and Introduction to Docker Compose
Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov
Making Developers Productive with Vagrant, VirtualBox, and Docker
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Docker and stuff
Vagrant For DevOps
Getting started with Docker
Introduction to Docker
DockerCon SF 2015: Orchestration for Sysadmins
Dockerizing your applications - Docker workshop @Twitter
Docker worshop @Twitter - How to use your own private registry
Docker Introduction
Docker 101 - Getting started
Docker: From Zero to Hero
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
Introduction to docker
Docker Basics
Docker lxc win
Ad

Viewers also liked (7)

PDF
Role based access control & rights management (2003)
PDF
Docker Workshop Experten Forum Stuttgart 2015, Agile Methoden GmbH
PDF
Was ist Docker ?
PPTX
Vagrant, Puppet, Docker für Entwickler und Architekten
PDF
Docker - Containervirtualisierung leichtgemacht
KEY
Puppet for Java developers - JavaZone NO 2012
PPTX
Docker Roadshow 2016
Role based access control & rights management (2003)
Docker Workshop Experten Forum Stuttgart 2015, Agile Methoden GmbH
Was ist Docker ?
Vagrant, Puppet, Docker für Entwickler und Architekten
Docker - Containervirtualisierung leichtgemacht
Puppet for Java developers - JavaZone NO 2012
Docker Roadshow 2016
Ad

Similar to Butter bei die Fische - Ein Jahr Entwicklung und Produktion mit Docker (20)

PPTX
You, and Me, and Docker Makes Three
PPTX
Docker and Microservice
PDF
Building Efficient Parallel Testing Platforms with Docker
PDF
An introduction to configuring Domino for Docker
PDF
Efficient Parallel Testing with Docker by Laura Frank
PPTX
Docker - A curtain raiser to the Container world
PDF
Instant ColdFusion with Vagrant
PDF
Efficient Parallel Testing with Docker
PDF
Use Docker to Enhance Your Testing
PDF
Preparing your dockerised application for production deployment
PDF
Instant ColdFusion with Vagrant
PDF
Introduction to Docker
PPTX
UNITde II - Docker-Containerization.pptx,
PDF
Killer Docker Workflows for Development
PPTX
Detailed Introduction To Docker
PPTX
Virtualization, Containers, Docker and scalable container management services
PDF
A curtain-raiser to the container world Docker & Kubernetes
PDF
DCEU 18: Building Your Development Pipeline
PDF
week8_watermark.pdfhowcanitbe minimum 40 i
PPTX
Everything you need to know about Docker
You, and Me, and Docker Makes Three
Docker and Microservice
Building Efficient Parallel Testing Platforms with Docker
An introduction to configuring Domino for Docker
Efficient Parallel Testing with Docker by Laura Frank
Docker - A curtain raiser to the Container world
Instant ColdFusion with Vagrant
Efficient Parallel Testing with Docker
Use Docker to Enhance Your Testing
Preparing your dockerised application for production deployment
Instant ColdFusion with Vagrant
Introduction to Docker
UNITde II - Docker-Containerization.pptx,
Killer Docker Workflows for Development
Detailed Introduction To Docker
Virtualization, Containers, Docker and scalable container management services
A curtain-raiser to the container world Docker & Kubernetes
DCEU 18: Building Your Development Pipeline
week8_watermark.pdfhowcanitbe minimum 40 i
Everything you need to know about Docker

Recently uploaded (20)

PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
CloudStack 4.21: First Look Webinar slides
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Architecture types and enterprise applications.pdf
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PPTX
The various Industrial Revolutions .pptx
PPT
Geologic Time for studying geology for geologist
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
August Patch Tuesday
PDF
DP Operators-handbook-extract for the Mautical Institute
PPT
What is a Computer? Input Devices /output devices
PPTX
Tartificialntelligence_presentation.pptx
Getting started with AI Agents and Multi-Agent Systems
A comparative study of natural language inference in Swahili using monolingua...
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
CloudStack 4.21: First Look Webinar slides
1 - Historical Antecedents, Social Consideration.pdf
Architecture types and enterprise applications.pdf
A contest of sentiment analysis: k-nearest neighbor versus neural network
sustainability-14-14877-v2.pddhzftheheeeee
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
The various Industrial Revolutions .pptx
Geologic Time for studying geology for geologist
Web Crawler for Trend Tracking Gen Z Insights.pptx
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
O2C Customer Invoices to Receipt V15A.pptx
A novel scalable deep ensemble learning framework for big data classification...
August Patch Tuesday
DP Operators-handbook-extract for the Mautical Institute
What is a Computer? Input Devices /output devices
Tartificialntelligence_presentation.pptx

Butter bei die Fische - Ein Jahr Entwicklung und Produktion mit Docker