SlideShare a Scribd company logo
Continuous Delivery with Containers:
The Good, the Bad, and the Ugly
Daniel Bryant
@danielbryantuk
Containers: Expectations versus reality
15/04/2018 @danielbryantuk
“DevOps”
Setting the scene…
• Continuous delivery is a large topic
• No business focus today (value stream etc)
• PaaS and Serverless are super interesting…
• But I’m assuming you’re all-in on containers
• Focusing today on the process and tooling
• No live coding today
• Mini-book contains more details (thanks nginx!)
15/04/2018 @danielbryantuk
bit.ly/2jWDSF7
TL;DR – Containers and CD
• Container image becomes the build pipeline ‘single binary’
• Adding metadata to containers images is vital, but challenging
• Must validate container constraints on system quality attributes (NFRs)
15/04/2018 @danielbryantuk
@danielbryantuk
• Independent Technical Consultant, Product Architect at Datawire
• Architecture, DevOps, Java, microservices, cloud, containers
• Continuous Delivery (CI/CD) advocate
• Leading change through technology and teams
15/04/2018 @danielbryantuk
Continuous Delivery 101
15/04/2018 @danielbryantuk
Continuous Delivery
• Produce valuable and robust software in short cycles
• Optimising for feedback and learning
• Not (necessarily) Continuous Deployment
15/04/2018 @danielbryantuk
Velocity (with stability) is key to business success
“Continuous delivery is achieved when stability and
speed can satisfy business demand.
Discontinuous delivery occurs when stability and speed
are insufficient.”
- Steve Smith (@SteveSmithCD)
15/04/2018 @danielbryantuk
Creation of a build pipeline is mandatory for continuous delivery
15/04/2018 @danielbryantuk
15/04/2018 @danielbryantuk
Feedback:
- Was our initial
hypothesis proven?
- How can we improve
business, architecture
and ops?
The impact of containers on CD
15/04/2018 @danielbryantuk
Container technology (and CD)
• OS-level virtualisation
• cgroups, namespaces, rootfs
• Package and execute software
• Container image == ‘single binary’
15/04/2018 @danielbryantuk
15/04/2018 @danielbryantuk
15/04/2018 @danielbryantuk
Microservices multiply the challenges
15/04/2018 @danielbryantuk
https://www.youtube.com/watch?v=b9Fu1So0bXA
Creating a pipeline for containers
15/04/2018 @danielbryantuk
15/04/2018 @danielbryantuk
Make your dev environment like production
• Develop locally or copy/code in container
• Must build/test containers locally
• Perform (at least) happy path tests
• Use identical base images from production
• With same configuration
15/04/2018 @danielbryantuk
Working remotely, locally…
15/04/2018 @danielbryantuk
https://opencredo.com/working-locally-with-microservices/
https://www.telepresence.io/
Lesson learned: Dockerfile content is super important
• OS choice
• Configuration
• Build artifacts
• Exposing ports
• Java
• JDK vs JRE and Oracle vs OpenJDK?
• Golang
• Statically compiled binary in scratch?
• Python
• Virtualenv?
15/04/2018 @danielbryantuk
Please talk to the sysadmin people:
Their operational knowledge is invaluable
15/04/2018 @danielbryantuk
Different test and prod containers?
• Create “test” version of container
• Full OS (e.g. Ubuntu)
• Test tools and data
• Easy to see app/configuration drift
• Use test sidecar containers instead
• ONTEST proposal by Alexi Ledenev
15/04/2018 @danielbryantuk
http://blog.terranillius.com/post/docker_testing/
Docker multi-stage builds
15/04/2018 @danielbryantuk
http://blog.alexellis.io/mutli-stage-docker-builds/
https://github.com/moby/moby/pull/31257
https://github.com/moby/moby/pull/32063
15/04/2018 @danielbryantuk
Building images with Jenkins
• My report covers this
• Build as usual…
• Build Docker Image
• Cloudbees Docker Build and Publish Plugin
• Push image to registry
15/04/2018 @danielbryantuk
Lesson learned: Metadata is valuable
• Application metadata
• Version / GIT SHA
• Build metadata
• Build date
• Image name
• Vendor
• Quality metadata
• QA control, signed binaries, ephemeral support
• Security profiles (AppArmor), Security audited etc
15/04/2018 @danielbryantuk
Metadata – Beware of “latest” Docker Tag
• Beware of the ‘latest’ Docker tag
• “Latest” simply means
• the last build/tag that ran without
a specific tag/version specified
• Ignore “latest” tag
• Version your tags, every time
• danielbryantuk/test:2.4.1
15/04/2018 @danielbryantuk
Metadata - Adding Labels at build time
• Docker Labels
• Add key/value data to image
15/04/2018 @danielbryantuk
Metadata - Adding Labels at build time
• Microscaling Systems’ Makefile
• Labelling automated builds on
DockerHub (h/t Ross Fairbanks)
• Create file ‘/hooks/build’
• label-schema.org
• microbadger.com
15/04/2018 @danielbryantuk
Metadata - Adding Labels at runtime
15/04/2018 @danielbryantuk
$ docker run -d --label
uk.co.danielbryant.lbname=frontdoor nginx
• Can ’docker commit’, but creates new image
• Not possible to update running container
• Docker Proposal: Update labels #21721
External registry with metadata support
15/04/2018 @danielbryantuk
Grafeas + Kritis
15/04/2018 @danielbryantuk
15/04/2018 @danielbryantuk
15/04/2018 @danielbryantuk
15/04/2018 @danielbryantuk
Running tests with containers
15/04/2018 @danielbryantuk
Testing NFRs in the build pipeline
• Architecture
• Performance and Load testing
• Gatling / jmeter / Flood.io
• Security testing
• Findsecbugs / OWASP Dependency check
• Bdd-security (OWASP ZAP) / Arachni
• Gauntlt / Serverspec
• Docker Bench for Security / CoreOS Clair
15/04/2018 @danielbryantuk
Security Visibility: Basic (Java) Code Scanning
15/04/2018 @danielbryantuk
Dependency Scanning
15/04/2018 @danielbryantuk
www.owasp.org/index.php/OWASP_Dependency_Check
Static Image Scanning
15/04/2018 @danielbryantuk
github.com/arminc/clair-scanner
Delaying NFRs to the ‘Last Responsible Moment’
Newsflash!
Sometimes the
last responsible moment
is up-front
Modern platforms/architectures
don’t necessarily make this easier
15/04/2018 @danielbryantuk
Important things not covered
15/04/2018 @danielbryantuk
Mechanical sympathy: Docker and Java
• Watch for JVM cgroup/taskset awareness (with JDK <= 8)
• getAvailableProcessors() may incorrectly report the number of cpus in Docker (JDK-8140793)
• Runtime.availableProcessors() ignores Linux taskset command (JDK-6515172)
• Default fork/join thread pool sizes (and others) is based from host CPU count
• Set container memory appropriately
• JVM requirements = Heap size (Xmx) + Metaspace + JVM overhead
• Account for native thread requirements e.g. thread stack size (Xss)
• Entropy
• Host entropy can soon be exhausted by crypto operations and /dev/random blocks
• -Djava.security.egd=file:/dev/./urandom (notes on this)
15/04/2018 @danielbryantuk 43
Deployment
15/04/2018 @danielbryantuk
https://blog.hasura.io/draft-vs-gitkube-vs-helm-vs-ksonnet-vs-metaparticle-vs-skaffold-f5aa9561f948
Observability is core to continuous delivery
15/04/2018 @danielbryantuk
www.infoq.com/articles/monitoring-containers-at-scale
Containers are not a silver bullet
15/04/2018 @danielbryantuk
Moving to containers: Going all-in?
15/04/2018 @danielbryantuk
OR
Should I build my own container platform?
Probably not
(Unless you are Google, AWS or IBM)
Whatever you decide…
push it through a pipeline ASAP!
15/04/2018 @danielbryantuk
Using containers does not get rid of the need for
good architectural practices
15/04/2018 @danielbryantuk
15/04/2018 @danielbryantuk
https://speakerdeck.com/caseywest/containercon-north-america-cloud-anti-patterns
Summary
15/04/2018 @danielbryantuk
In summary
• Continuous delivery is vitally important in modern architectures/ops
• Container images must be the (single) source of truth within pipeline
• And metadata added as appropriate…
• Mechanical sympathy is important (assert properties in the pipeline)
• Not all developers are operationally aware
• The tooling is now becoming stable/mature
• We need to re-apply existing CD practices with new technologies/tooling
15/04/2018 @danielbryantuk
Thanks for listening…
Twitter: @danielbryantuk
Email: daniel.bryant@tai-dev.co.uk
Writing: https://www.infoq.com/profile/Daniel-Bryant
Talks: https://www.youtube.com/playlist?list=PLoVYf_0qOYNeBmrpjuBOOAqJnQb3QAEtM
15/04/2018 @danielbryantuk
bit.ly/2jWDSF7
Coming soon!
Bedtime reading
15/04/2018 @danielbryantuk
Bonus slides (for extra context)
15/04/2018 @danielbryantuk
Containerise an existing (monolithic) app?
• For
• We know the monolith well
• Allows homogenization of the
pipeline and deployment platform
• Can be a demonstrable win for
tech and the business
• Against
• Can be difficult (100+ line scripts)
• Often not designed for operation
within containers, nor cloud native
• Putting lipstick on a pig?
15/04/2018 @danielbryantuk
Key lessons learned
• Conduct an architectural review
• Architecture for Developers, by Simon Brown
• Architecture Interview, by Susan Fowler
• Look for data ingress/egress
• File system access
• Support resource constraints/transience
• Optimise for quick startup and shutdown
• Evaluate approach to concurrency
• Store configuration (secrets) remotely
15/04/2018 @danielbryantuk
New design patterns
15/04/2018 @danielbryantuk
bit.ly/2efe0TP
Microservices…
Containers and microservices are
complementary
Testing and deployment change
15/04/2018 @danielbryantuk
https://specto.io/blog/recipe-for-designing-building-testing-microservices.html
15/04/2018 @danielbryantuk
15/04/2018 @danielbryantuk
15/04/2018 @danielbryantuk
Quick Aside: Running *entire* system locally
15/04/2018 @danielbryantuk
https://news.ycombinator.com/item?id=13960107
https://opencredo.com/working-locally-with-microservices/
https://www.datawire.io/telepresence/ | https://hoverfly.io/

More Related Content

PPTX
JAX DevOps 2018 "Continuous Delivery Patterns for Modern Architectures"
PPTX
Devoxx 2017 "Continuous Delivery with Containers: The Good, the Bad, and the ...
PPTX
SATURN 2018 "Continuous Delivery with Containers" Extended 90 version
PPTX
deliver:Agile 2018 "Continuous Delivery Patterns for Modern Architectures"
PPTX
O'Reilly SACON "Continuous Delivery Patterns for Contemporary Architecture"
PPTX
vJUG24 2017 "Continuous Delivery Patterns for Contemporary Architecture"
PPTX
microXchg 2018: "What is a Service Mesh? Do I Need One When Developing 'Cloud...
PDF
JAXDevOps 2017 "The Seven (More) Deadly Sins of Microservices
JAX DevOps 2018 "Continuous Delivery Patterns for Modern Architectures"
Devoxx 2017 "Continuous Delivery with Containers: The Good, the Bad, and the ...
SATURN 2018 "Continuous Delivery with Containers" Extended 90 version
deliver:Agile 2018 "Continuous Delivery Patterns for Modern Architectures"
O'Reilly SACON "Continuous Delivery Patterns for Contemporary Architecture"
vJUG24 2017 "Continuous Delivery Patterns for Contemporary Architecture"
microXchg 2018: "What is a Service Mesh? Do I Need One When Developing 'Cloud...
JAXDevOps 2017 "The Seven (More) Deadly Sins of Microservices

What's hot (20)

PPTX
O'Reilly/Nginx 2016: "Continuous Delivery with Containers: The Trials and Tri...
PDF
#AATC2017: "Continuous Delivery with Containers: The Trials and Tribulations"
PDF
DevOpsCon 2017 "Continuous Delivery with Containers"
PDF
AllDayDevOps: "Microservices: The People and Organisational Impact"
PPTX
vJUG 2017 "Continuous Delivery with Java and Docker: The Good, the Bad, and t...
PPTX
J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"
PPTX
ContainerSched 2017 "Continuous Delivery with Containers: The Good, the Bad, ...
PDF
JAXLondon 2017 "Continuous Delivery with Containers and Java"
PDF
Moving to Agile Methods and DevOps on IBM i with ARCAD Pack for Rational 1479...
PPT
Innovate2014 Better Integrations Through Open Interfaces
PPTX
CloudNativeLondon 2017: "What is a Service Mesh, and Do I Need One when Devel...
PPSX
CI-CD Jenkins, GitHub Actions, Tekton
PPTX
Your API is Bad and You Should Feel Bad
PPTX
Enterprise Software Architecture styles
PPTX
Microservice Architecture
PPT
Innovate2014 Panel - Best Practices on Implementing Integrations
PPSX
Microservices, Containers, Kubernetes, Kafka, Kanban
PPTX
Knockout js
PDF
cross cloud inter-operability with iPaaS and serverless for Telco cloud SDN/NFV
PPTX
Bahrain ch9 introduction to docker 5th birthday
O'Reilly/Nginx 2016: "Continuous Delivery with Containers: The Trials and Tri...
#AATC2017: "Continuous Delivery with Containers: The Trials and Tribulations"
DevOpsCon 2017 "Continuous Delivery with Containers"
AllDayDevOps: "Microservices: The People and Organisational Impact"
vJUG 2017 "Continuous Delivery with Java and Docker: The Good, the Bad, and t...
J1 2015 "Building a Microservice Ecosystem: Some Assembly Still Required"
ContainerSched 2017 "Continuous Delivery with Containers: The Good, the Bad, ...
JAXLondon 2017 "Continuous Delivery with Containers and Java"
Moving to Agile Methods and DevOps on IBM i with ARCAD Pack for Rational 1479...
Innovate2014 Better Integrations Through Open Interfaces
CloudNativeLondon 2017: "What is a Service Mesh, and Do I Need One when Devel...
CI-CD Jenkins, GitHub Actions, Tekton
Your API is Bad and You Should Feel Bad
Enterprise Software Architecture styles
Microservice Architecture
Innovate2014 Panel - Best Practices on Implementing Integrations
Microservices, Containers, Kubernetes, Kafka, Kanban
Knockout js
cross cloud inter-operability with iPaaS and serverless for Telco cloud SDN/NFV
Bahrain ch9 introduction to docker 5th birthday
Ad

Similar to Codemotion Rome 2018 "Continuous Delivery with Containers: The Good, the Bad and the Ugly" (20)

PPTX
Continuous Delivery with Containers: The Good, the Bad, and the Ugly - Daniel...
PPTX
Continuous Delivery with Containers: The Good, the Bad, and the Ugly
PPTX
O'Reilly 2016: "Continuous Delivery with Containers: The Trials and Tribulati...
PPTX
CodeOne SF 2018 "Continuous Delivery with Containers: Lessons Learned"
PPTX
JAX London 2014 "Building Java Applications for the Cloud: The DHARMA princip...
PDF
DCEU 18: Continuous Delivery with Docker Containers and Java: The Good, the B...
PPTX
DockerCon EU 2018 "Continuous Delivery with Docker and Java"
PPTX
OReilly SACON 2016 "A Practical Guide for Continuous Delivery with Containers"
PPTX
JavaOne 2014: Cloud Developer's DHARMA: Redefining 'done' for Cloud applications
PPTX
jSpring 2018 "Continuous Delivery Patterns for Modern Architectures and Java"
PDF
GOTO Chicago/CraftConf 2017 "The Seven (More) Deadly Sins of Microservices"
PPTX
Jax London 2018: "Testing Microservices from Development to Production"
PPTX
LJC 05/14 "Cloud Developer's DHARMA"
PDF
Haufe #msaday - Seven More Deadly Sins of Microservices by Daniel Bryant
PDF
The seven more deadly sins of microservices final
PDF
Haufe #msaday - Building a Microservice Ecosystem by Daniel Bryant
PDF
Building a microservice ecosystem
PDF
Haufe #msaday: "Building a Microservice Ecosystem"
PPTX
CodeOne 2019: "Continuous Delivery with Docker and Java"
PDF
vJUG24 2016 "Seven (More) Deadly Sins of Microservice"
Continuous Delivery with Containers: The Good, the Bad, and the Ugly - Daniel...
Continuous Delivery with Containers: The Good, the Bad, and the Ugly
O'Reilly 2016: "Continuous Delivery with Containers: The Trials and Tribulati...
CodeOne SF 2018 "Continuous Delivery with Containers: Lessons Learned"
JAX London 2014 "Building Java Applications for the Cloud: The DHARMA princip...
DCEU 18: Continuous Delivery with Docker Containers and Java: The Good, the B...
DockerCon EU 2018 "Continuous Delivery with Docker and Java"
OReilly SACON 2016 "A Practical Guide for Continuous Delivery with Containers"
JavaOne 2014: Cloud Developer's DHARMA: Redefining 'done' for Cloud applications
jSpring 2018 "Continuous Delivery Patterns for Modern Architectures and Java"
GOTO Chicago/CraftConf 2017 "The Seven (More) Deadly Sins of Microservices"
Jax London 2018: "Testing Microservices from Development to Production"
LJC 05/14 "Cloud Developer's DHARMA"
Haufe #msaday - Seven More Deadly Sins of Microservices by Daniel Bryant
The seven more deadly sins of microservices final
Haufe #msaday - Building a Microservice Ecosystem by Daniel Bryant
Building a microservice ecosystem
Haufe #msaday: "Building a Microservice Ecosystem"
CodeOne 2019: "Continuous Delivery with Docker and Java"
vJUG24 2016 "Seven (More) Deadly Sins of Microservice"
Ad

More from Daniel Bryant (20)

PDF
ITKonekt 2023: The Busy Platform Engineers Guide to API Gateways
PDF
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
PDF
PlatformCon 23: "The Busy Platform Engineers Guide to API Gateways"
PDF
Java Meetup 23: 'Debugging Microservices "Remocally" in Kubernetes with Telep...
PPTX
DevRelCon 2022: "Is Product Led Growth (PLG) the “DevOps” of the DevRel World"
PDF
Fall 22: "From Kubernetes to PaaS to... err, what's next"
PDF
Building Microservice Systems Without Cooking Your Laptop: Going “Remocal” wi...
PDF
KubeCrash 22: Debugging Microservices "Remocally" in Kubernetes with Telepres...
PDF
JAX London 22: Debugging Microservices "Remocally" in Kubernetes with Telepre...
PDF
CloudBuilders 2022: "The Past, Present, and Future of Cloud Native API Gateways"
PDF
KubeCon EU 2022: From Kubernetes to PaaS to Err What's Next
PDF
Devoxx UK 22: Debugging Java Microservices "Remocally" in Kubernetes with Tel...
PDF
DevXDay KubeCon NA 2021: "From Kubernetes to PaaS to Developer Control Planes"
PDF
JAX London 2021: Jumpstart Your Cloud Native Development: An Overview of Prac...
PDF
Container Days: Easy Debugging of Microservices Running on Kubernetes with Te...
PDF
Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-...
PDF
MJC 2021: "Debugging Java Microservices Running on Kubernetes with Telepresence"
PDF
LJC 4/21"Easy Debugging of Java Microservices Running on Kubernetes with Tele...
PDF
GOTOpia 2/2021 "Cloud Native Development Without the Toil: An Overview of Pra...
PPTX
HashiCorp Webinar: "Getting started with Ambassador and Consul on Kubernetes ...
ITKonekt 2023: The Busy Platform Engineers Guide to API Gateways
CraftConf 2023 "Microservice Testing Techniques: Mocks vs Service Virtualizat...
PlatformCon 23: "The Busy Platform Engineers Guide to API Gateways"
Java Meetup 23: 'Debugging Microservices "Remocally" in Kubernetes with Telep...
DevRelCon 2022: "Is Product Led Growth (PLG) the “DevOps” of the DevRel World"
Fall 22: "From Kubernetes to PaaS to... err, what's next"
Building Microservice Systems Without Cooking Your Laptop: Going “Remocal” wi...
KubeCrash 22: Debugging Microservices "Remocally" in Kubernetes with Telepres...
JAX London 22: Debugging Microservices "Remocally" in Kubernetes with Telepre...
CloudBuilders 2022: "The Past, Present, and Future of Cloud Native API Gateways"
KubeCon EU 2022: From Kubernetes to PaaS to Err What's Next
Devoxx UK 22: Debugging Java Microservices "Remocally" in Kubernetes with Tel...
DevXDay KubeCon NA 2021: "From Kubernetes to PaaS to Developer Control Planes"
JAX London 2021: Jumpstart Your Cloud Native Development: An Overview of Prac...
Container Days: Easy Debugging of Microservices Running on Kubernetes with Te...
Canadian CNCF: "Emissary-ingress 101: An introduction to the CNCF incubation-...
MJC 2021: "Debugging Java Microservices Running on Kubernetes with Telepresence"
LJC 4/21"Easy Debugging of Java Microservices Running on Kubernetes with Tele...
GOTOpia 2/2021 "Cloud Native Development Without the Toil: An Overview of Pra...
HashiCorp Webinar: "Getting started with Ambassador and Consul on Kubernetes ...

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Empathic Computing: Creating Shared Understanding
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
Teaching material agriculture food technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Modernizing your data center with Dell and AMD
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Approach and Philosophy of On baking technology
Advanced methodologies resolving dimensionality complications for autism neur...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Review of recent advances in non-invasive hemoglobin estimation
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
“AI and Expert System Decision Support & Business Intelligence Systems”
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Empathic Computing: Creating Shared Understanding
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Spectral efficient network and resource selection model in 5G networks
NewMind AI Weekly Chronicles - August'25 Week I
Teaching material agriculture food technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
NewMind AI Monthly Chronicles - July 2025
Dropbox Q2 2025 Financial Results & Investor Presentation
Modernizing your data center with Dell and AMD
Building Integrated photovoltaic BIPV_UPV.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Approach and Philosophy of On baking technology

Codemotion Rome 2018 "Continuous Delivery with Containers: The Good, the Bad and the Ugly"

  • 1. Continuous Delivery with Containers: The Good, the Bad, and the Ugly Daniel Bryant @danielbryantuk
  • 2. Containers: Expectations versus reality 15/04/2018 @danielbryantuk “DevOps”
  • 3. Setting the scene… • Continuous delivery is a large topic • No business focus today (value stream etc) • PaaS and Serverless are super interesting… • But I’m assuming you’re all-in on containers • Focusing today on the process and tooling • No live coding today • Mini-book contains more details (thanks nginx!) 15/04/2018 @danielbryantuk bit.ly/2jWDSF7
  • 4. TL;DR – Containers and CD • Container image becomes the build pipeline ‘single binary’ • Adding metadata to containers images is vital, but challenging • Must validate container constraints on system quality attributes (NFRs) 15/04/2018 @danielbryantuk
  • 5. @danielbryantuk • Independent Technical Consultant, Product Architect at Datawire • Architecture, DevOps, Java, microservices, cloud, containers • Continuous Delivery (CI/CD) advocate • Leading change through technology and teams 15/04/2018 @danielbryantuk
  • 7. Continuous Delivery • Produce valuable and robust software in short cycles • Optimising for feedback and learning • Not (necessarily) Continuous Deployment 15/04/2018 @danielbryantuk
  • 8. Velocity (with stability) is key to business success “Continuous delivery is achieved when stability and speed can satisfy business demand. Discontinuous delivery occurs when stability and speed are insufficient.” - Steve Smith (@SteveSmithCD) 15/04/2018 @danielbryantuk
  • 9. Creation of a build pipeline is mandatory for continuous delivery 15/04/2018 @danielbryantuk
  • 10. 15/04/2018 @danielbryantuk Feedback: - Was our initial hypothesis proven? - How can we improve business, architecture and ops?
  • 11. The impact of containers on CD 15/04/2018 @danielbryantuk
  • 12. Container technology (and CD) • OS-level virtualisation • cgroups, namespaces, rootfs • Package and execute software • Container image == ‘single binary’ 15/04/2018 @danielbryantuk
  • 15. Microservices multiply the challenges 15/04/2018 @danielbryantuk https://www.youtube.com/watch?v=b9Fu1So0bXA
  • 16. Creating a pipeline for containers 15/04/2018 @danielbryantuk
  • 18. Make your dev environment like production • Develop locally or copy/code in container • Must build/test containers locally • Perform (at least) happy path tests • Use identical base images from production • With same configuration 15/04/2018 @danielbryantuk
  • 19. Working remotely, locally… 15/04/2018 @danielbryantuk https://opencredo.com/working-locally-with-microservices/ https://www.telepresence.io/
  • 20. Lesson learned: Dockerfile content is super important • OS choice • Configuration • Build artifacts • Exposing ports • Java • JDK vs JRE and Oracle vs OpenJDK? • Golang • Statically compiled binary in scratch? • Python • Virtualenv? 15/04/2018 @danielbryantuk
  • 21. Please talk to the sysadmin people: Their operational knowledge is invaluable 15/04/2018 @danielbryantuk
  • 22. Different test and prod containers? • Create “test” version of container • Full OS (e.g. Ubuntu) • Test tools and data • Easy to see app/configuration drift • Use test sidecar containers instead • ONTEST proposal by Alexi Ledenev 15/04/2018 @danielbryantuk http://blog.terranillius.com/post/docker_testing/
  • 23. Docker multi-stage builds 15/04/2018 @danielbryantuk http://blog.alexellis.io/mutli-stage-docker-builds/ https://github.com/moby/moby/pull/31257 https://github.com/moby/moby/pull/32063
  • 25. Building images with Jenkins • My report covers this • Build as usual… • Build Docker Image • Cloudbees Docker Build and Publish Plugin • Push image to registry 15/04/2018 @danielbryantuk
  • 26. Lesson learned: Metadata is valuable • Application metadata • Version / GIT SHA • Build metadata • Build date • Image name • Vendor • Quality metadata • QA control, signed binaries, ephemeral support • Security profiles (AppArmor), Security audited etc 15/04/2018 @danielbryantuk
  • 27. Metadata – Beware of “latest” Docker Tag • Beware of the ‘latest’ Docker tag • “Latest” simply means • the last build/tag that ran without a specific tag/version specified • Ignore “latest” tag • Version your tags, every time • danielbryantuk/test:2.4.1 15/04/2018 @danielbryantuk
  • 28. Metadata - Adding Labels at build time • Docker Labels • Add key/value data to image 15/04/2018 @danielbryantuk
  • 29. Metadata - Adding Labels at build time • Microscaling Systems’ Makefile • Labelling automated builds on DockerHub (h/t Ross Fairbanks) • Create file ‘/hooks/build’ • label-schema.org • microbadger.com 15/04/2018 @danielbryantuk
  • 30. Metadata - Adding Labels at runtime 15/04/2018 @danielbryantuk $ docker run -d --label uk.co.danielbryant.lbname=frontdoor nginx • Can ’docker commit’, but creates new image • Not possible to update running container • Docker Proposal: Update labels #21721
  • 31. External registry with metadata support 15/04/2018 @danielbryantuk
  • 32. Grafeas + Kritis 15/04/2018 @danielbryantuk
  • 36. Running tests with containers 15/04/2018 @danielbryantuk
  • 37. Testing NFRs in the build pipeline • Architecture • Performance and Load testing • Gatling / jmeter / Flood.io • Security testing • Findsecbugs / OWASP Dependency check • Bdd-security (OWASP ZAP) / Arachni • Gauntlt / Serverspec • Docker Bench for Security / CoreOS Clair 15/04/2018 @danielbryantuk
  • 38. Security Visibility: Basic (Java) Code Scanning 15/04/2018 @danielbryantuk
  • 40. Static Image Scanning 15/04/2018 @danielbryantuk github.com/arminc/clair-scanner
  • 41. Delaying NFRs to the ‘Last Responsible Moment’ Newsflash! Sometimes the last responsible moment is up-front Modern platforms/architectures don’t necessarily make this easier 15/04/2018 @danielbryantuk
  • 42. Important things not covered 15/04/2018 @danielbryantuk
  • 43. Mechanical sympathy: Docker and Java • Watch for JVM cgroup/taskset awareness (with JDK <= 8) • getAvailableProcessors() may incorrectly report the number of cpus in Docker (JDK-8140793) • Runtime.availableProcessors() ignores Linux taskset command (JDK-6515172) • Default fork/join thread pool sizes (and others) is based from host CPU count • Set container memory appropriately • JVM requirements = Heap size (Xmx) + Metaspace + JVM overhead • Account for native thread requirements e.g. thread stack size (Xss) • Entropy • Host entropy can soon be exhausted by crypto operations and /dev/random blocks • -Djava.security.egd=file:/dev/./urandom (notes on this) 15/04/2018 @danielbryantuk 43
  • 45. Observability is core to continuous delivery 15/04/2018 @danielbryantuk www.infoq.com/articles/monitoring-containers-at-scale
  • 46. Containers are not a silver bullet 15/04/2018 @danielbryantuk
  • 47. Moving to containers: Going all-in? 15/04/2018 @danielbryantuk OR
  • 48. Should I build my own container platform? Probably not (Unless you are Google, AWS or IBM) Whatever you decide… push it through a pipeline ASAP! 15/04/2018 @danielbryantuk
  • 49. Using containers does not get rid of the need for good architectural practices 15/04/2018 @danielbryantuk
  • 52. In summary • Continuous delivery is vitally important in modern architectures/ops • Container images must be the (single) source of truth within pipeline • And metadata added as appropriate… • Mechanical sympathy is important (assert properties in the pipeline) • Not all developers are operationally aware • The tooling is now becoming stable/mature • We need to re-apply existing CD practices with new technologies/tooling 15/04/2018 @danielbryantuk
  • 53. Thanks for listening… Twitter: @danielbryantuk Email: daniel.bryant@tai-dev.co.uk Writing: https://www.infoq.com/profile/Daniel-Bryant Talks: https://www.youtube.com/playlist?list=PLoVYf_0qOYNeBmrpjuBOOAqJnQb3QAEtM 15/04/2018 @danielbryantuk bit.ly/2jWDSF7 Coming soon!
  • 55. Bonus slides (for extra context) 15/04/2018 @danielbryantuk
  • 56. Containerise an existing (monolithic) app? • For • We know the monolith well • Allows homogenization of the pipeline and deployment platform • Can be a demonstrable win for tech and the business • Against • Can be difficult (100+ line scripts) • Often not designed for operation within containers, nor cloud native • Putting lipstick on a pig? 15/04/2018 @danielbryantuk
  • 57. Key lessons learned • Conduct an architectural review • Architecture for Developers, by Simon Brown • Architecture Interview, by Susan Fowler • Look for data ingress/egress • File system access • Support resource constraints/transience • Optimise for quick startup and shutdown • Evaluate approach to concurrency • Store configuration (secrets) remotely 15/04/2018 @danielbryantuk
  • 58. New design patterns 15/04/2018 @danielbryantuk bit.ly/2efe0TP
  • 59. Microservices… Containers and microservices are complementary Testing and deployment change 15/04/2018 @danielbryantuk https://specto.io/blog/recipe-for-designing-building-testing-microservices.html
  • 63. Quick Aside: Running *entire* system locally 15/04/2018 @danielbryantuk https://news.ycombinator.com/item?id=13960107 https://opencredo.com/working-locally-with-microservices/ https://www.datawire.io/telepresence/ | https://hoverfly.io/