SlideShare a Scribd company logo
Matthias Lübken
Container Patterns
@luebken
github.com/openshift/origin
Patterns in a Containerized World (Matthias Luebken Technology Stream)
Patterns in a Containerized World (Matthias Luebken Technology Stream)
Patterns in a Containerized World (Matthias Luebken Technology Stream)
projectatomic.io
github.com/opencontainers
“ Easily create lightweight,
portable, self-sufficient containers

from any application.”
Since containers are a great way of 

package and deliver software …
What if we use containers to
modularise our application?
“Containers […] are
destined to become
analogous to 

objects in object-
oriented software
systems”
“This makes a
container not just a
program, but rather,
a part of a program.”


“A Container Is A
Function Call”.
Independently
releasable
Separate
processing types
Different
loads
Different
teams
Reuse
Crash
isolation
Use differentlanguages / versions / libraries
POCs
1. Properties of a module container
Outline
2. Patterns for assembling these
Patterns in a Containerized World (Matthias Luebken Technology Stream)
github.com/luebken/container-patterns
“Module-Container”
A Module Container is
1. Linux process
2. API
3. Descriptive
4. Disposable
5. Immutable
6. Self-contained
7. Small
8. Adaptive
1. Linux Process
1. Linux Process
• React to signals
• Return exit codes
• Use standard streams
• Handle arguments

Examples: module-container.md#1-linux-process
2. API
2. API
• ENV variables
• Available ports
• Volume mounts
• Lifecycle hooks

Examples: module-container.md#2-api
3. Descriptive
3. Descriptive
• Use standard labels (e.g. proposal generic labels)
• url, summary, vcs-url …
• Use custom labels:
• io.openshift.wants
• io.openshift.expose-services


Examples: module-container.md#3-descriptive
Standardising Labels
• https://github.com/projectatomic/
ContainerApplicationGenericLabels
• http://label-schema.org/rc1/
4. Disposable
4. Disposable
• Don’t rely on a particular instance
• Be aware of shots at your cattle
• Be robust against sudden death



Examples: module-container.md#4-disposable
5. Immutable
5. Immutable
• Don’t change your container after build
• Strive or a dev/prod parity


Examples: module-container.md#5-immutable
6. Self-contained
6. Self-contained
• Add dependencies on build time
• Sensible defaults



Examples: module-container.md#6-self-contained
7. Small
7. Small
• Don’t use large base images
• Use the minimal footprint



Examples: module-container.md#6-small
8. Adaptive
8. Adaptive
• Anticipate the environment & react to change
• Software appliance
• Container reinitiates of config changes
• http://autopilotpattern.io
A Module Container is
1. Linux process
2. API
3. Descriptive
4. Disposable
5. Immutable
6. Self-contained
7. Small
8. Adaptive
1. Properties of a module container
Outline
2. Patterns for assembling these
nginx

Proxy
Rails

Frontend
A Go

Backend
A Node

Backend
nginx

Proxy
Rails

Frontend
A Go

Backend
A Node

Backend
Redis
Cache
Logging
Adapter
Service
Ambassador
A group of closely related containers.
Deployed as a single unit 

and share namespaces.
A Node

Backend
Redis
Cache
Logging
Adapter
Service
Ambassador
Pattern: Sidecar / Sidekick
Enhance & extend the main container.
K8S: transparently. Netflix: platform features.
UDSA Node

Backend
MAIN CONTAINER
Redis

Cache
SIDECAR
Pod
A Node

Backend
Redis
Cache
Logging
Adapter
Service

Ambassador
Pattern: Adapter
Standardise and normalize output.
E.g. logging and metrics.
localhost or
A Node

Backend
MAIN CONTAINER
Monitoring
Adapter
ADAPTER
Pod
A Node

Backend
Redis
Cache
Logging
Adapter
Service

Ambassador
Proxy a local connection to the world:
Service Discovery, Client Side LB, Circuit Breaker
A Node

Backend
MAIN CONTAINER
Service
Discovery
AMBASSADOR
Pattern: Ambassador
localhost
(Pod)
Pattern: Container chains
Defined order of starting and stopping sidecar containers.
A Node

Backend
MAIN CONTAINER
Storage

Config
SIDECAR
Discovery
SIDECAR
Network

Config
SIDECAR
(Pod)
Summary
Module container
1. Linux process
2. API
3. Descriptive
4. Disposable
5. Immutable
6. Self-contained
7. Small
Assembling
• Sidecar
• Adapter
• Ambassador
• Chains
Properties of a
module container.
Patterns of
assembling
github.com/luebken/container-patterns @luebken
Dankeschön.
@luebken
Credits
• https://www.flickr.com/photos/skynoir/8241460998 (Cover image)
• https://www.flickr.com/photos/amlz/8664728590 (Lego)
• https://www.flickr.com/photos/guidedbycthulhu/6810361241 (Socket)
• https://www.flickr.com/photos/seektan/2074853585/ (Label)
• https://www.flickr.com/photos/gullevek/2122873934 (Trash)
• https://www.flickr.com/photos/grantmac/4852826923 (Lock)
• https://www.flickr.com/photos/mhirano/13236048424 (Hand)
Patterns in a Containerized World (Matthias Luebken Technology Stream)
Old slides
Patterns in a Containerized World (Matthias Luebken Technology Stream)
Other image guidelines
General Docker image guidelines 

by the OpenShift team
• Reuse images
• Maintain compatibility within
tags
• Avoid multiple processes
• Use exec in wrapper scripts
• Clean temporary files
• Place instructions in the proper
order
• Mark important ports
• Set Environment Variables
• Avoid Default Passwords
• Avoid SSHD
• Use volumes for persistent data
https://docs.openshift.com/container-platform/3.3/creating_images/guidelines.html
Guidance for Docker Image Authors
by Project Atomic
• Use MAINTAINER
• Know the difference
between CMD and
ENTRYPOINT
• Always use exec in
wrapper scripts
• Always EXPOSE important
ports
• Use Volumes appropriately
• Use USER
http://www.projectatomic.io/docs/docker-image-author-guidance/
Best practices for writing Dockerfiles
by Docker
• Containers should be
ephemeral
• Use a .dockerignore file
• Avoid installing
unnecessary packages
• Run only one process per
container
• Minimize the number of
layers
• Sort multi-line arguments
• Build cache
https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
Patterns in a Containerized World (Matthias Luebken Technology Stream)
Container Patterns
•For designing “cloud” applications.
•Container runtime agnostic.
•Are there general applicable patterns?
•How would we describe them?
•What are concrete examples and best-practices?
Differentiate
Not app per container
Not host container
Related Work
• 12factor.net apps
• Cloud-native application architectures:

Matt Stine Free Ebook
• Microservices
• Continuous Delivery
Closely Related Work
nginx

Proxy
Rails

Frontend
A Go

Backend
A Node

Backend
An Application
POC github.com/luebken/container-api
nginx

Proxy
Rails

Frontend
A Go

Backend
A Node

Backend
Redis
Cache
Logging
Adapter
Service
Ambassador
TODO clean up notes
Links / References
http://blog.james-carr.org/2013/09/04/parameterized-docker-containers/
https://docs.docker.com/articles/dockerfile_best-practices/
http://tldp.org/LDP/abs/html/exitcodes.html (Exit Codes for “Proper Linux Process”)
http://www.theregister.co.uk/2013/03/18/servers_pets_or_cattle_cern/ (Pets vs Cattle)
http://www.projectatomic.io/docs/docker-image-author-guidance/ (Dockerfile)
http://www.hokstad.com/docker/patterns (Dev patterns)
http://blog.kubernetes.io/2015/06/the-distributed-system-toolkit-patterns.html (Composite Patterns)
http://static.googleusercontent.com/media/research.google.com/de//pubs/archive/43438.pdf (Borg by
Google inspiration for Kubernetes / Pods)
http://techblog.netflix.com/2014/11/prana-sidecar-for-your-netflix-paas.html (Sidecar Netflix)
WALK THROUGH
Other / old slides
More info:
● https://docs.giantswarm.io/fundamentals/user-services/container-injection/
● https://docs.giantswarm.io/fundamentals/user-services/service-discovery/
Example: Service Discovery @ Giant Swarm
Reasons for splitting up
Independently releasable
Separate processing types
Different loads
Different teams
Reuse of containers
Crash isolation
Different release cycles
Use different languages / versions / libraries
Patterns in a Containerized World (Matthias Luebken Technology Stream)

More Related Content

PPTX
Building microservices with docker
PPTX
Docker - Portable Deployment
PPTX
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
PDF
Introduction to Containers and Docker for PHP developers
PPTX
Introduction to kubernetes
PDF
JOSA TechTalks - Docker in Production
PDF
Introduction to Containers and Docker for PHP developers
PDF
Dockers and kubernetes
Building microservices with docker
Docker - Portable Deployment
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
Introduction to Containers and Docker for PHP developers
Introduction to kubernetes
JOSA TechTalks - Docker in Production
Introduction to Containers and Docker for PHP developers
Dockers and kubernetes

What's hot (20)

PPTX
Virtual Container - Docker
PPTX
Getting started with docker (2017)
PDF
Kubernetes overview and Exploitation
PPTX
Docker-Intro
PPTX
An Introduction to Kubernetes
PPTX
Containers #101 Meetup: Containers and OpenStack
PDF
Containers in depth – Understanding how containers work to better work with c...
PDF
Openstack starter-guide-diablo
PPTX
Containers #101 Meetup: Containers & OpenStack
PDF
An introduction to contianers and Docker for PHP developers
PDF
Kubernetes: The Next Research Platform
PPTX
Windows server containers
PDF
Pluggable Infrastructure with CI/CD and Docker
PDF
Kubernetes in Docker
PPT
Docker 101 for "The Core of Microservice Architecture"
PPTX
Docker 101 : Introduction to Docker and Containers
PPTX
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
PPTX
Kubernetes Workshop
PPTX
Virtualization, Containers, Docker and scalable container management services
Virtual Container - Docker
Getting started with docker (2017)
Kubernetes overview and Exploitation
Docker-Intro
An Introduction to Kubernetes
Containers #101 Meetup: Containers and OpenStack
Containers in depth – Understanding how containers work to better work with c...
Openstack starter-guide-diablo
Containers #101 Meetup: Containers & OpenStack
An introduction to contianers and Docker for PHP developers
Kubernetes: The Next Research Platform
Windows server containers
Pluggable Infrastructure with CI/CD and Docker
Kubernetes in Docker
Docker 101 for "The Core of Microservice Architecture"
Docker 101 : Introduction to Docker and Containers
Write Once and REALLY Run Anywhere | OpenStack Summit HK 2013
Kubernetes Workshop
Virtualization, Containers, Docker and scalable container management services
Ad

Similar to Patterns in a Containerized World (Matthias Luebken Technology Stream) (20)

PPTX
Container Patterns
PDF
Dennis Benkert & Matthias Lübken - Patterns in a containerized world? - code....
PDF
Containers and microservices for realists
PDF
Containers and Microservices for Realists
PDF
The ABC of Docker: The Absolute Best Compendium of Docker
PPTX
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
PDF
Docker-in-Action 1st edition.pdf
PDF
Dockercon EU 2014
PDF
Rackspace::Solve NYC - The Future of Applications with Ken Cochrane, Engineer...
PDF
Accelerate your software development with Docker
PPTX
Accelerate your development with Docker
PDF
Alfresco TechQuest 2024 - Alfresco Container-based Installation and Configura...
PPTX
State of the Container Ecosystem
PPTX
Docker presentation
PDF
Docker dev ops for cd meetup 12-14
PDF
A curtain-raiser to the container world Docker & Kubernetes
PPTX
The challenge of application distribution - Introduction to Docker (2014 dec ...
PDF
Demystifying Containerization Principles for Data Scientists
PDF
DCSF19 Containers for Beginners
PDF
Introduction to Docker
Container Patterns
Dennis Benkert & Matthias Lübken - Patterns in a containerized world? - code....
Containers and microservices for realists
Containers and Microservices for Realists
The ABC of Docker: The Absolute Best Compendium of Docker
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
Docker-in-Action 1st edition.pdf
Dockercon EU 2014
Rackspace::Solve NYC - The Future of Applications with Ken Cochrane, Engineer...
Accelerate your software development with Docker
Accelerate your development with Docker
Alfresco TechQuest 2024 - Alfresco Container-based Installation and Configura...
State of the Container Ecosystem
Docker presentation
Docker dev ops for cd meetup 12-14
A curtain-raiser to the container world Docker & Kubernetes
The challenge of application distribution - Introduction to Docker (2014 dec ...
Demystifying Containerization Principles for Data Scientists
DCSF19 Containers for Beginners
Introduction to Docker
Ad

More from IT Arena (20)

PDF
Shalini Agarwal, LinkedIn. Engineering excellence: marathon, not a sprint
PDF
Dave Karow, Split. Powering Progressive Delivery With Data
PDF
Ihar Mahaniok, Angel Investor. Hunting unicorns for early stage investments
PDF
Yuriy Zaremba, AXDRAFT. How to sell your startup
PDF
John Griffin, Ford Credit Europe. Normalising failure and making way for succ...
PDF
Vitaliy Diatlenko, Uklon. Transforming your business with machine learning. T...
PDF
Chris Cassarino, SoftServe. Stop Fixating on Fixing – Solving the global enga...
PDF
Michael Labate, Intellias. EDI in the DNA: Why Equity, Diversity and Inclusio...
PDF
Beth Anne Katz, Microsoft. How to Product Manage Your Mental Health
PDF
Sally Foote, GoCompare & Look After My Bills. Magic Goggles: the tools you ne...
PDF
Colleen Graneto, Airbnb. 3 steps to better product decision making
PDF
Vasyl Zadvornyy, Prozorro. The Future of Governance: Can a Script Replace the...
PDF
Godard Abel, G2. The SaaS Trust Crisis
PDF
Zeb Evans, ClickUp. From $0 to $20M ARR in 2 Years: Bootstrapping to Natural ...
PPTX
Namir Anani, ICTC. Economic Resiliency in The Face of Adversity
PDF
Mada Seghete, Branch. Mobile Growth Trends
PDF
Julia Petryk, MacPaw. Product PR: a how-to guide
PDF
Yaroslav Ravlinko, Intellias. You don’t need Kubernetes. You need to understa...
PDF
Yaroslav Novytskyy, Anton Vasylenko, N-iX. Migrating to the cloud: options an...
PDF
Kostiantyn Bokhan, N-iX. CD4ML based on Azure and Kubeflow
Shalini Agarwal, LinkedIn. Engineering excellence: marathon, not a sprint
Dave Karow, Split. Powering Progressive Delivery With Data
Ihar Mahaniok, Angel Investor. Hunting unicorns for early stage investments
Yuriy Zaremba, AXDRAFT. How to sell your startup
John Griffin, Ford Credit Europe. Normalising failure and making way for succ...
Vitaliy Diatlenko, Uklon. Transforming your business with machine learning. T...
Chris Cassarino, SoftServe. Stop Fixating on Fixing – Solving the global enga...
Michael Labate, Intellias. EDI in the DNA: Why Equity, Diversity and Inclusio...
Beth Anne Katz, Microsoft. How to Product Manage Your Mental Health
Sally Foote, GoCompare & Look After My Bills. Magic Goggles: the tools you ne...
Colleen Graneto, Airbnb. 3 steps to better product decision making
Vasyl Zadvornyy, Prozorro. The Future of Governance: Can a Script Replace the...
Godard Abel, G2. The SaaS Trust Crisis
Zeb Evans, ClickUp. From $0 to $20M ARR in 2 Years: Bootstrapping to Natural ...
Namir Anani, ICTC. Economic Resiliency in The Face of Adversity
Mada Seghete, Branch. Mobile Growth Trends
Julia Petryk, MacPaw. Product PR: a how-to guide
Yaroslav Ravlinko, Intellias. You don’t need Kubernetes. You need to understa...
Yaroslav Novytskyy, Anton Vasylenko, N-iX. Migrating to the cloud: options an...
Kostiantyn Bokhan, N-iX. CD4ML based on Azure and Kubeflow

Recently uploaded (20)

PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
cuic standard and advanced reporting.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
KodekX | Application Modernization Development
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Modernizing your data center with Dell and AMD
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Understanding_Digital_Forensics_Presentation.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
cuic standard and advanced reporting.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Dropbox Q2 2025 Financial Results & Investor Presentation
Empathic Computing: Creating Shared Understanding
NewMind AI Monthly Chronicles - July 2025
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Unlocking AI with Model Context Protocol (MCP)
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
KodekX | Application Modernization Development
Per capita expenditure prediction using model stacking based on satellite ima...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
Modernizing your data center with Dell and AMD

Patterns in a Containerized World (Matthias Luebken Technology Stream)