patterns and antipatterns in docker image lifecycle as was presented at scale 15x

69
This slide was intentionally left blank

Upload: baruch-sadogursky

Post on 12-Apr-2017

199 views

Category:

Travel


2 download

TRANSCRIPT

Page 1: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

This slide was intentionally left blank

Page 2: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 3: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

whoami

Baruch Sadogursky, JFrog Developer Advocate, @jbaruch

Page 4: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Show notes!• http://jfrog.com/shownotes– Video– Slides– Links– Feedback– Raffle! (come early)

Page 5: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

JFrog Xray

Page 6: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Poll Time!

Page 7: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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

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

Page 8: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 9: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 10: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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

Page 11: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

JFrog Artifactory + Docker

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

Page 12: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Who’s using Docker and nothing else?

Page 13: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 14: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 15: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

The Promotion Pyramid

Developmentbuilds

Dev Integrationtests

Integr.tests

StagingPre-ProdProd

Amountofbuilds

Build/Dep

loytim

e

Amountofbinaries

Page 16: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Pipeline: Quality Gates and Visibility

Source:AgileALM,MichaelHüttermann,ManningPublicationsCo.

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

Page 17: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

$docker build

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

Page 18: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 19: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Too easy!

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

Page 20: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 21: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

That’s why.

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

FROM ubuntu

RUN apt-get install -y software-properties-common pythonRUN apt-get install -y nodejsRUN mkdir /var/www

ADD app.js /var/www/app.js

CMD ["/usr/bin/node", "/var/www/app.js"]

Latestversion

Latestversion

Latestversion

Latestversion

Page 22: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

That’s why.

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

FROM ubuntu:14.04

RUN apt-get install -y software-properties-common pythonRUN apt-get install -y nodejsRUN mkdir /var/www

ADD app.js /var/www/app.js

CMD ["/usr/bin/node", "/var/www/app.js"]

Betternow?

Page 23: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

That’s why.

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

FROM ubuntu:4033353383af19ec179c01dda7f355a246c6adcafaf93c8f98

RUN apt-get install -y software-properties-common pythonRUN apt-get install -y nodejsRUN mkdir /var/www

ADD app.js /var/www/app.js

CMD ["/usr/bin/node", "/var/www/app.js"]

Andnow?

Page 24: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

That’s why.

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

FROM ubuntu:4033353383af19ec179c01dda7f355a246c6adcafaf93c8f98

RUN apt-get install -y software-properties-common pythonRUN apt-get install -y nodejsRUN mkdir /var/www

ADD app.js /var/www/app.js

CMD ["/usr/bin/node", "/var/www/app.js"]

Andnow?Whataboutthose?

Page 25: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

That’s why.

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

FROM ubuntu:4033353383af19ec179c01dda7f355a246c6adcafaf93c8f98

RUN mvn clean install

CMD ”java –jar Main.class"

Whataboutthis?

Page 26: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

That’s why.

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

FROM ubuntu:4033353383af19ec179c01dda7f355a246c6adcafaf93c8f98

RUN download_random_sh*t_from_the_internet.sh

CMD ["/usr/bin/node", "/var/www/app.js"]

Andhowaboutthis?

Page 27: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

That’s why you don’t trust Docker

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

Page 28: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Traditional Server Pattern

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

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

Page 29: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Immutable Server Pattern

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

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

Page 30: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 31: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 32: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

What’s up with the gates?!

Page 33: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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

Page 34: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

What’s up with the gates?!

Page 35: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

What’s up with the gates?!

- QA shouldn’t test dev images

Page 36: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

What’s up with the gates?!

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

staged

Page 37: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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 38: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Not so fast…

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

Page 39: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Trumped-up limitations

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

Page 40: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

The Anatomy of Docker Tag

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

Page 41: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Waitasecond,howcanIhavemorethanone

repositoryperhostnow?!

Page 42: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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 #SCALE15X HTTP://JFROG.COM/SHOWNOTES

Page 43: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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

Page 44: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Panic!

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

Page 45: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Virtual hosts/ports to the rescue

Registryhost Tagname

docker tag host:port/busybox

Page 46: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Virtual hosts/ports to the rescue

https://host:port/v2/busybox

Registryhost Tagname

docker tag host:port/busybox

Page 47: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Virtual hosts/ports to the rescue

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

Virtualrepositoryname Tagname

https://host:port/v2/busybox

Contextname

Registryhost Tagname

docker tag host:port/busybox

Page 48: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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 #SCALE15X HTTP://JFROG.COM/SHOWNOTES

Page 49: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

But then you realize…Waitasecond,nowIneedtopull,retagandpushfor

everystep?!

Page 50: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 51: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 52: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Anatomy of a container

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

Page 53: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Our LayersApplication:••.warfile

Framework:••JDK8+Wildfly

Base:••CentOS

Page 54: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Framework build

- Verified base image- Add system dependencies

from artifactory- JDK- Tomcat- Own it!

Page 55: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Minimal Framework build DockerfileFROM centos:7MAINTAINER [email protected]

@jbaruch #devnexus http://jfrog.com/shownotes

Page 56: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

Application build

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

Page 57: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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

ADD https://yourorg.jfrog.io/yourorg/java-release-local/…/app-[RELEASE].war /opt/jboss/wildfly/standalone/deployments/app.war

Page 58: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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

ADD https://yourorg.jfrog.io/yourorg/java-release-local/…/app-[RELEASE].war /opt/jboss/wildfly/standalone/deployments/app.war

Page 59: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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

ADD https://yourorg.jfrog.io/yourorg/java-release-local/…/app-[RELEASE].war /opt/jboss/wildfly/standalone/deployments/app.war

Page 60: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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

ADD https://yourorg.jfrog.io/yourorg/java-release-local/…/app-[RELEASE].war /opt/jboss/wildfly/standalone/deployments/app.war

Page 61: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 62: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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

Page 63: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

FrameworkPipeline

ApplicationPipeline

Page 64: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

FrameworkPipeline

ApplicationPipeline

Page 65: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

FrameworkPipeline

ApplicationPipeline

Page 66: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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

Page 67: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Page 68: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

HIGH QUALITY(software and information) SPEED LOW COST

(automation)

Fast releases > Modular > Automation

Conclusions: Release Fast or Die!

Page 69: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x

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