Top Banner
This slide was intentionally left blank
63

Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Feb 14, 2017

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

This slide was intentionally left blank

Page 2: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 3: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

whoami

Baruch Sadogursky, JFrog Developer Advocate, @jbaruch

Page 4: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

JFrog Xray

Page 5: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Poll Time!

Page 6: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Poll Time!üHeard about DockerüCan do the tutorialüPoCing, playing etc.üProduction, baby!

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 7: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 8: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 9: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 10: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

JFrog Artifactory + Docker

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 11: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Who’s using Docker and nothing else?

Page 12: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 13: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 14: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

The Promotion Pyramid

Developmentbuilds

Dev Integrationtests

Integr.tests

StagingPre-ProdProd

Amountofbuilds

Build/Dep

loytim

e

Amountofbinaries

Page 15: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Pipeline: Quality Gates and Visibility

Source:AgileALM,MichaelHüttermann,ManningPublicationsCo.

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 16: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

$docker build

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 17: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 18: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Too easy!

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 19: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 20: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

That’s why.

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 21: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Let’s fix it!

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 22: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Let’s fix it (again)!

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 23: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Let’s fix it (again)!

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 24: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

That’s why you don’t trust Docker

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 25: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Traditional Server Pattern

http://martinfowler.com/bliki/ImmutableServer.html

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 26: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Immutable Server Pattern

http://martinfowler.com/bliki/ImmutableServer.html

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 27: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 28: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 29: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

What’s up with the gates?!

Page 30: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 31: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

What’s up with the gates?!

Page 32: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

What’s up with the gates?!

- QA shouldn’t test dev images

Page 33: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

What’s up with the gates?!

- QA shouldn’t test dev images- non-tested images shouldn't be

staged

Page 34: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

What’s up with the gates?!

- QA shouldn’t test dev images- non-tested images shouldn't be

staged- non-staged, non-tested or dev

images shouldn’t end up in production!!!

Page 35: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Not so fast…

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 36: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Trumped-up limitations

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 37: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

The Anatomy of Docker Tag

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 38: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Waitasecond,howcanIhavemorethanone

repositoryperhostnow?!

Page 39: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

How can we support this?

https://host:8081/artifactory/docker-dev/busybox

https://host:8081/artifactory/docker-staging/busybox

https://host:8081/artifactory/docker-qa/busybox

https://host:8081/artifactory/docker-prod/busybox

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 40: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

“ONE REGISTRY PER HOST OUGHT TO BE ENOUGH FOR ANYBODY.”

Page 41: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Panic!

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 42: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Virtual hosts/ports to the rescue

https://host:8081/artifactory/docker-dev/busybox

Contextname

VirtualrepositorynameTagname

https://host:port/v2/busybox

Page 43: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

server {listen 5001;

server_name 192.168.99.100;if ($http_x_forwarded_proto = '') {

set $http_x_forwarded_proto $scheme;}rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/docker-dev/$1/$2;…}

}

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 44: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

But then you realize…Waitasecond,nowIneedtopull,retagandpushfor

everystep?!

Page 45: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 46: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 47: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Anatomy of a container

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 48: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Our LayersApplication:••.warfile

Framework:••JDK8+Tomcat

Base:••ubuntu-trusty

Page 49: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Framework build

- Verified base image- Add system dependencies

from artifactory- JDK- Tomcat- Own it!

Page 50: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Minimal Framework build DockerfileFROM ubuntu:14.04MAINTAINER [email protected]

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 51: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Application build

- Framework is your base- Run a java build- Add a file to base- Done!

Page 52: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Application build DockerfileFROM yourorg-docker.jfrog.io/myorg/framework:latestMAINTAINER [email protected]

ADD https://yourorg.jfrog.io/jbaruch/java-release-local/…/app-[RELEASE].war /var/lib/tomcat7/webapps/app.war

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 53: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Application build DockerfileFROM yourorg-docker.jfrog.io/myorg/framework:latestMAINTAINER [email protected]

ADD https://yourorg.jfrog.io/jbaruch/java-release-local/…/app-[RELEASE].war /var/lib/tomcat7/webapps/app.war

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 54: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Application build DockerfileFROM yourorg-docker.jfrog.io/myorg/framework:latestMAINTAINER [email protected]

ADD https://yourorg.jfrog.io/jbaruch/java-release-local/…/app-[RELEASE].war /var/lib/tomcat7/webapps/app.war

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 55: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 56: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 57: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

FrameworkPipeline

ApplicationPipeline

Page 58: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

FrameworkPipeline

ApplicationPipeline

Page 59: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

FrameworkPipeline

ApplicationPipeline

Page 60: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

@JBARUCH #CODEMASH HTTP://JFROG.COM/SHOWNOTES

Page 61: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Page 62: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

HIGH QUALITY(software and information) SPEED LOW COST

(automation)

Fast releases > Modular > Automation

Conclusions: Release Fast or Die!

Page 63: Patterns and antipatterns in Docker image lifecycle @ Codemash 2017

Q&A and Links• @jbaruch• #codemash• http://jfrog.com/shownotes– Video– Slides– Links– Feedback– Raffle! (come early)