Daniël van Gils
Developer Advocate
@foldingbeauty
daniel@cloud66.com
www.cloud66.com
Running Microservices in
Production with Docker
= public/private/hybrid = yours
Services
ǽ
> 4000 serversEasy Ops tools build for Devs
• The services are easy to replace.
• Services are organized around capabilities, e.g., user
interface front-end, recommendation, logistics, billing, etc.
• Services can be implemented using different programming
languages, databases, hardware and software environment,
depending on what fits best.
microservice architecture
ƗƗƗ
Ɨ
Ɨ
ƗƗ
Ɨ
Ɨ
Ɨ
Ɨ
Ɨ
Ɨǽ
ƗƗ Ɨǽ
ƗƗ
Ɨǽ
ƗƗ Ɨǽ
ƗƗ
NOISE
$docker run alpine echo 'hello world’
production
?
$docker-compose up -d
time
skills
Ɨ
ǽ
#1 the right container image
#2 containers in production
ƗƗ
microservice example
service
Ɨ containers
server cluster(s)Ȑ
imageƗǽ
ƗƗ
= code
= docker file
= docker engine
= platform
Ɨ
build
ship
deploy
Ɨǽ
test test
Ɨǽ
Ɨǽ
dev machine
continuous
integration
continuous
deployment
code
service
Ɨ
Ɨ
api
Ɨǽ
Ɨǽ
worker
message
queue
frontend
request work
status update
microservice example
Ɨ
ƗƗǽ
Ɨǽ
I can bake 1 donut
in x seconds.
message
queue
I want 5
donuts
request 5 donuts
donuts are baking
donuts are ready
I know how to receive
orders and give
orders to baking
minions.
https://github.com/cloud66-samples/webinar_codefresh
ƗƗ
Ɨ
Ɨǽ
ƗƗ Ɨǽ
ƗƗ
Ɨǽ
ƗƗ Ɨǽ
ƗƗ
Ɨǽ
ƗƗ Ɨǽ
ƗƗ
Ɨǽ
ƗƗ Ɨǽ
ƗƗ
Ɨǽ
ƗƗ
isolated test
Ɨǽ
ƗƗ
isolated test
(API)
Ɨǽ
ƗƗ
isolated test
(WORKER)
Ɨǽ
ƗƗ
integration test + development
Ɨǽ
ƗƗ
Ɨǽ
ƗƗ Ɨǽ
ƗƗ
containerization
Ǹ
the containerization machine
ƗƗƗ
you can’t polish a turd
Ɨ
containerization
Ǹ
Dž
ƗƗƗ =
Ɨǽ
“The right image should be the same in all your
environments.”
Ɨǽ
“The right tests should be the same in all your
environments.”
Ɨǽ
“I didn't have time to create a slim image,
so I created a fat one instead.”
Ɨǽ
“The right image needs at least 5 kisses”
kiss = keep an image s…, smart ass
slim secure speedy stable set
SLIM
Start with the smallest minimal
image you can find and trust.
Remove compile time
dependencies.
Remove packages you don’t need.
Squash layers to reduce size.
Run stats for the image.
habitus.io
blog.cloud66.com
Ɨǽ
SLIM
SECURE
SPEEDY
STABLE

SET
Ɨǽ
SECURE
Remove all the secrets.
Patch to the latest security
updates.
Run the image with the
right UID.
Test the image.
https://github.com/docker/
docker-bench-security
Ɨǽ
SMALL
SECURE
SPEEDY
STABLE

SET
Ɨǽ
SPEEDY
Optimize code.
Memory and cpu usage.
One process.
Load testing.
Ɨǽ
SLIM
SECURE
SPEEDY
STABLE

SET
Ɨǽ
STABLE
Lock the image version.
Lock the runtime version(s).
Tag your image.
Proper logging.
Ɨǽ
SLIM
SECURE
SPEEDY
STABLE

SET
Ɨǽ
SET
Use volumes wisely, use
external services for
persistency, don’t abuse
host system.
Loosely coupled.
Remove things which are
hard to maintain in
production.
Ɨǽ
Reality Check!
Ɨǽ
Ɨ 
monolith containerization ± 70 %
(multi tenant)
monolith 1x
monolith image FAT
Ɨǽ
Ɨ

API first containerization ± 20%
Ɨǽ
Ɨ
api 1x
frontend 1x
image frontend FAT
image api FAT
Ɨǽ
Ɨ

splitting monolith containerization ± 6%
Ɨǽ
api 6x
frontend 1x
Ɨǽ
Ɨ
workers 10x
ƗƗƗ
ƗƗƗƗ
ƗƗ
image frontend FAT
image api THIN
image workers THIN
ƗƗƗ
ƗƗ
Ɨ
Ɨǽ
Ɨǽ
A 6x
B 12x
Ɨǽ
Ɨ
C 10x
ƗƗƗ
ƗƗƗƗ
ƗƗ
image B THIN
image A THIN
image C THIN
ƗƗƗ
ƗƗ
Ɨ
microservice architecture ± 4%
ƗƗƗ
ƗƗ
ƗƗ
ƗƗ
ƗƗ
Ɨ

message queue
Ɨǽ
microservice
microimage
microplatform?
law of conservation of energy?
LIFE CYCLE
Ɨǽ
ORCHESTRATION
DISCOVERY
SECURITY
SCALING
DATA
MANAGEMENT
MONITORING
SCHEDULING
Choose your platform wisely.
LIFE CYCLE
Ɨǽ
ORCHESTRATION
DISCOVERY
SECURITY
SCALING
DATA
MANAGEMENT
MONITORING
SCHEDULING
LIFE CYCLE
Ɨǽ
ORCHESTRATION
DISCOVERY
SECURITY
SCALING
DATA
MANAGEMENT
MONITORING
SCHEDULING
LIFECYCLE
Have an image guideline.
Create a workflow using the same
image in all the software cycle
stages.
From design to production mimic
the environment.
Test heavily.
Ǻ
LIFE CYCLE
Ɨǽ
ORCHESTRATION
DISCOVERY
SECURITY
SCALING
DATA
MANAGEMENT
MONITORING
SCHEDULING
ORCHESTRATION
Provisioning nodes.
Networking.
Isolation of services.
Self healing.
iOi = Infrastructure on
Infrastructure.
Ǻ
LIFE CYCLE
Ɨǽ
ORCHESTRATION
DISCOVERY
SECURITY
SCALING
DATA
MANAGEMENT
MONITORING
SCHEDULING
DISCOVERY
Find your services and
datasources with minimal code
change.
Versioning of running services.
Automagically update
discovery when services come
and go.
Ǻ
LIFE CYCLE
Ɨǽ
ORCHESTRATION
DISCOVERY
SECURITY
SCALING
DATA
MANAGEMENT
MONITORING
SCHEDULING
SCALING/SCHEDULING
Scale your service (= more
running containers).
Scale your nodes.
Scale your on/off jobs.
Failover groups.
Hybrid infrastructure.
Load balancing.
Ǻ
LIFE CYCLE
Ɨǽ
ORCHESTRATION
DISCOVERY
SECURITY
SCALING
DATA
MANAGEMENT
MONITORING
SCHEDULING
DATA MANAGEMENT
Backup and restores.
Clustering.
Verify your backups.
Ǻ

LIFE CYCLE
Ɨǽ
ORCHESTRATION
DISCOVERY
SECURITY
SCALING
DATA
MANAGEMENT
MONITORING
SCHEDULING
MONITORING
Get all the statistics of
resources (mem/load/net/res) used.
Aggregating of logs.
Key debugging ingredient.
Ǻ
ǟ
LIFE CYCLE
Ɨǽ
ORCHESTRATION
DISCOVERY
SECURITY
SCALING
DATA
MANAGEMENT
MONITORING
SCHEDULING
SECURITY
Node and Engine level.
Intrusion detection and
prevention systems.
DoS protection.
Firewall.
Segregate container groups
Verification of images.
Ǻ
Ǻ
Choose your platform wisely.
When you get DevOps, Testing,
Microservices architecture right and creating
the right minimal lovable Image and having
the right platform to run containers. Happy
Camper.
ǽ
THANK YOU
www.cloud66.com (free docker in production platform trial)
www.codefresh.com
www.habitus.io (open source docker build flow tool)
startwithdocker.com (easy starter for docker)
https://github.com/cloud66-samples/webinar_codefresh
```
Ɨǽ
Daniël van Gils
Developer Advocate
@foldingbeauty
daniel@cloud66.com
www.cloud66.com

How do I run microservices in production using Docker.