patterns and antipatterns in docker image lifecycle as was presented at scale 15x
TRANSCRIPT
![Page 1: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/1.jpg)
This slide was intentionally left blank
![Page 2: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/2.jpg)
![Page 3: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/3.jpg)
whoami
Baruch Sadogursky, JFrog Developer Advocate, @jbaruch
![Page 4: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/4.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/5.jpg)
JFrog Xray
![Page 6: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/6.jpg)
Poll Time!
![Page 7: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/7.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/8.jpg)
![Page 9: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/9.jpg)
![Page 10: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/10.jpg)
@JBARUCH #SCALE15X HTTP://JFROG.COM/SHOWNOTES
![Page 11: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/11.jpg)
JFrog Artifactory + Docker
@JBARUCH #SCALE15X HTTP://JFROG.COM/SHOWNOTES
![Page 12: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/12.jpg)
Who’s using Docker and nothing else?
![Page 13: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/13.jpg)
![Page 14: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/14.jpg)
![Page 15: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/15.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/16.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/17.jpg)
$docker build
@JBARUCH #SCALE15X HTTP://JFROG.COM/SHOWNOTES
![Page 18: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/18.jpg)
![Page 19: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/19.jpg)
Too easy!
@JBARUCH #SCALE15X HTTP://JFROG.COM/SHOWNOTES
![Page 20: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/20.jpg)
![Page 21: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/21.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/22.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/23.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/24.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/25.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/26.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/27.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/28.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/29.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/30.jpg)
![Page 31: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/31.jpg)
![Page 32: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/32.jpg)
What’s up with the gates?!
![Page 33: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/33.jpg)
@JBARUCH #SCALE15X HTTP://JFROG.COM/SHOWNOTES
![Page 34: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/34.jpg)
What’s up with the gates?!
![Page 35: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/35.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/36.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/37.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/38.jpg)
Not so fast…
@JBARUCH #SCALE15X HTTP://JFROG.COM/SHOWNOTES
![Page 39: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/39.jpg)
Trumped-up limitations
@JBARUCH #SCALE15X HTTP://JFROG.COM/SHOWNOTES
![Page 40: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/40.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/41.jpg)
Waitasecond,howcanIhavemorethanone
repositoryperhostnow?!
![Page 42: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/42.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/43.jpg)
“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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/44.jpg)
Panic!
@JBARUCH #SCALE15X HTTP://JFROG.COM/SHOWNOTES
![Page 45: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/45.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/46.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/47.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/48.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/49.jpg)
But then you realize…Waitasecond,nowIneedtopull,retagandpushfor
everystep?!
![Page 50: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/50.jpg)
![Page 51: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/51.jpg)
![Page 52: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/52.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/53.jpg)
Our LayersApplication:••.warfile
Framework:••JDK8+Wildfly
Base:••CentOS
![Page 54: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/54.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/55.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/56.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/57.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/58.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/59.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/60.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/61.jpg)
![Page 62: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/62.jpg)
@JBARUCH #SCALE15X HTTP://JFROG.COM/SHOWNOTES
![Page 63: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/63.jpg)
FrameworkPipeline
ApplicationPipeline
![Page 64: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/64.jpg)
FrameworkPipeline
ApplicationPipeline
![Page 65: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/65.jpg)
FrameworkPipeline
ApplicationPipeline
![Page 66: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/66.jpg)
@JBARUCH #SCALE15X HTTP://JFROG.COM/SHOWNOTES
![Page 67: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/67.jpg)
![Page 68: Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/68.jpg)
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](https://reader031.vdocuments.us/reader031/viewer/2022021507/58ed2b251a28ab99628b4647/html5/thumbnails/69.jpg)
Q&A and Links• @jbaruch• #scale15x• http://jfrog.com/shownotes– Video– Slides– Links– Feedback– Raffle! (come early)