SlideShare a Scribd company logo
@jbaruch #oraclecode
Docker Version –
Best Practices
@jbaruch #oraclecode
About me
»@jbaruch
»Developer Advocate @JFrog
»We might still have some t-shirts left!
@jbaruch #oraclecode
Poll Time!
@jbaruch #oraclecode
Poll Time!
»Heard about Docker
»Can do the tutorial
»PoCing, playing etc.
»Production, baby!
@jbaruch #oraclecode
@jbaruch #oraclecode
@jbaruch #oraclecode
@jbaruch #oraclecode
JFrog Artifactory + Docker
@jbaruch #oraclecode
»There are 2 hard problems in computer science:
cache invalidation,
naming things,
and off-by-1 errors.
@jbaruch #oraclecode
Naming Things
with Docker
@jbaruch #oraclecode
Who
Cares
About
Versions
Anyhow
?
@jbaruch #oraclecode
Why Do We Care about versions?
»Pipeline Automation/Orchestration
»Traceability/Communication
»Maintainability/Storage Management
@jbaruch #oraclecode
Those are old news,
we have been using versions for years
»Docker is different !!
»Versions are Tags
@jbaruch #oraclecode
Docker Manifest and Tags
ac-image:1.0 ac-image:1.0-beta ac-image:1.0-qa
Manifest
sha256:252564..
Manifest
sha256:462564..
ac-image:1.1
OS: SHA2
Framework: SHA2
Application: SHA2: 3
Layers
Application: SHA2: 4
Tags
Manife
st
@jbaruch #oraclecode
So let’s talk about tags in detail
»Mutable and Dynamic in nature
»Example: my-image:5.0
»And Latest is not latest
»Confusion !!
@jbaruch #oraclecode
my-image:5.0
OS layer
1.0
Framework
layer 2.0
Application
layer 2.0
OS layer
1.1
Framework
layer 2.1
Application
layer 2.1
Yesterday Today
@jbaruch #oraclecode
The case for `latest`
And other mutable tags
@jbaruch #oraclecode
Convenient promotion
@jbaruch #oraclecode
Automation:
Docker Image Promotion Process across
silos
@jbaruch #oraclecode
Promotion
ac-image:1.0-
dev
ac-image:1.0-qa
ac-image:1.0-
release
Manifest
sha256:252564..
OS: SHA2
Framework: SHA2
Application: SHA2: 3
L
a
y
e
r
s
T
a
g
s
@jbaruch #oraclecode
Pull, retag, push for every stage? It’s
nuts!!!
@jbaruch #oraclecode
We got you covered
@jbaruch #oraclecode
The case for immutable
tags
@jbaruch #oraclecode
Traceability!
»We always know what this image is
»Trace it back to CI
»Trace it back to source
@jbaruch #oraclecode
Traceability: Classic Approaches
»Version Names based On Git Hashes
»Version Names based on Jenkins Builds
»Version Names based on the packaged software
version number
»Version names with a unique date
(the build timestamp)
@jbaruch #oraclecode
So which one is
better?
@jbaruch #oraclecode
Static vs. Dynamic Tags
»Static Tags:
⋄Assigned at image CREATION
⋄Reflect metadata that traces the tag to its build and/or contents
»Dynamic Tags:
⋄Reflect an image you should use, the current known-good version
⋄Classic example is ubuntu:trusty
⋄Remember, ‘latest’ isn’t actually latest, just one tagged as such!
@jbaruch #oraclecode
Love and Hate the dynamic versions
Pros Cons
Versions express promotion state Consistency
No version – trash! Traceability
@jbaruch #oraclecode
Best Practices – Best of two worlds!
@jbaruch #oraclecode
Double Tag
»Push every image with a static tag
»Create a second, dynamic tag for the same
image as appropriate
⋄Just a like a sym-link
⋄Tag name is not traceable by itself, because the “dynamic”
tag may have moved since client pulled.
⋄Docker Inspect, Search, Find image for traceability
»Cleanup static tags based on some policy
@jbaruch #oraclecode
Static and Dynamic Tags
ac-image:1.0-
2017-04-01-
111
ac-image:latest1-
beta
ac-image:latest1
Manifest
sha256:252564..
Manifest
sha256:462564..
ac-image:1.0-
2017-04-03-
222
OS: SHA2
Framework: SHA2
Application: SHA2: 3
L
a
y
e
r
s Application: SHA2: 4
T
a
g
s
ac-
image:latest1
@jbaruch #oraclecode
The orphans
@jbaruch #oraclecode
Another problem!
»So, if we change tags during promotion, what
happens to not promoted images?
»They loose their version!!!
(WTF, what does that mean?)
@jbaruch #oraclecode
The unlucky ones
»In Java we call it SNAPSHOT-s.
»In Docker – images without versions.
»They are huge!
@jbaruch #oraclecode
@jbaruch #oraclecode
You don’t really have unlimited space
@jbaruch #oraclecode
How Docker Registries
Work
@jbaruch #oraclecode
Docker Distribution and DTR
»Checksum based storage
⋄Multiple tags with the same manifest does not use up additional disk
space
»Deleting a tag does NOT delete the layers from
storage
⋄Actual Delete based on SHA2 reference ONLY
⋄Tag is effectively deleted if you re-push with a same tag
⋄Old Manifest remains, and still referenceable by SHA2
@jbaruch #oraclecode
Deleting a tag does NOT delete
the layers from storage
ac-image:1.0 ac-image:1.0-beta ac-image:1.0-qa
Manifest
sha256:252564..
Manifest
sha256:462564..
ac-image:1.1
OS: SHA2
Framework: SHA2
Application: SHA2: 3
L
a
y
e
r
s Application: SHA2: 4
T
a
g
s
@jbaruch #oraclecode
Actual DELETE is based on SHA2
reference ONLY
ac-image:1.0 ac-image:1.0-qa
Manifest
sha256:252564..
Manifest
sha256:462564..
ac-image:1.1
OS: SHA2
Framework: SHA2
Application: SHA2: 3
L
a
y
e
r
s Application: SHA2: 4
T
a
g
s
Delete via
SHA2
@jbaruch #oraclecode
Docker GC
»Required to delete layers with no manifests
»Required to clear up disk space
»Stop the world
@jbaruch #oraclecode
Docker Distribution, Best Practice
»Delete layers without tags up front.
⋄HEAD Tag get SHA2 of manifest
⋄Delete SHA2
⋄After deleting reference, run GC to clean up
@jbaruch #oraclecode
Docker Distribution, Best Practice
»(Not OOB) To clean up a registry with manifests
that have no tag
⋄Command used to find these layers:
comm -23 <(find . -type f -name "link" | grep
"_manifests/revisions/sha256" | grep -v "/signatures/sha256/" | awk -F/
'{print $(NF-1)}' | sort) <(for f in $(find . -type f -name "link" | grep
"_manifests/tags/.*/current/link"); do cat ${f} | sed 's/^sha256://g';
echo; done | sort) | wc –l
@jbaruch #oraclecode
JFrog Artifactory
»We delete any layer that is not referenced by a
tag immediately
»We delete manifests that is not referenced by a
tag
»We have an API to copy/move a docker image or
change its tag without using the docker client to
pull/push a second time
»Configure the max number of tags per image
@jbaruch #oraclecode
Built-in cleanup
ac-image:1.0 ac-image:1.0-qa
Manifest
sha256:252564..
Manifest
sha256:462564..
ac-image:1.1
OS: SHA2
Framework: SHA2
Application: SHA2: 3
L
a
y
e
r
s Application: SHA2: 4
T
a
g
s
Delete via
SHA2
Manifest
sha256:462564..
ac-image:1.2
Application: SHA2: 5
Delete Tag
@jbaruch #oraclecode
Recap
»Dynamic versions are good for promotion
»Static versions are good for traceability
»Retagging should be done in the registry
»All unreferenced objects should be collected
@jbaruch #oraclecode
Q&A and Links
»@jbaruch
»jfrog.com/shownotes
»We’re hiring!

More Related Content

PPTX
A new model for Docker image distribution
PDF
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
PDF
Trust your containers in production as was presented at DockerCon 2017
PDF
Patterns and antipatterns in Docker image lifecycle as was presented at Devop...
PDF
Docker Registry V2
PDF
DockerCon SF 2015: A New Model for Image Distribution
PDF
Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...
PDF
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...
A new model for Docker image distribution
Patterns and antipatterns in Docker image lifecycle as was presented at Scale...
Trust your containers in production as was presented at DockerCon 2017
Patterns and antipatterns in Docker image lifecycle as was presented at Devop...
Docker Registry V2
DockerCon SF 2015: A New Model for Image Distribution
Patterns and antipatterns in Docker image lifecycle as was presented at DC Do...
Patterns and antipatterns in Docker image lifecycle as was presented at Oracl...

Similar to Best Practices for Managing Docker Versions as presented at JavaOne 2017 (20)

PDF
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
PDF
Patterns and antipatterns in Docker image lifecycle as was presented at Globa...
PDF
Continuous Integration with Docker on AWS
PDF
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
PPTX
JFrog container registry - DevOps extravaganza
PDF
Trust your software in production as it was presented at Detroit JUG
PDF
Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
PPTX
Docker Container Lifecycles, Problem or Opportunity? by Baruch Sadogursky, JFrog
PPTX
Docker Meetup Paris: enterprise Docker
PDF
Security Patterns for Microservice Architectures - SpringOne 2020
PDF
Security Patterns for Microservice Architectures
PDF
Docker in Continuous Integration
PDF
Dockercon EU 2014
PPTX
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
PDF
DockerCon EU 2015: Day 1 General Session
PDF
Docker from A to Z, including Swarm and OCCS
PDF
Accelerate your software development with Docker
PPTX
Accelerate your development with Docker
PDF
LXC to Docker Via Continuous Delivery
PDF
Containerize All the (Multi-Platform) Things! by Phil Estes
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Patterns and antipatterns in Docker image lifecycle as was presented at Globa...
Continuous Integration with Docker on AWS
Patterns and antipatterns in Docker image lifecycle @ DevOpsDays Charlotte 2017
JFrog container registry - DevOps extravaganza
Trust your software in production as it was presented at Detroit JUG
Patterns and antipatterns in Docker image lifecycle @ Codemash 2017
Docker Container Lifecycles, Problem or Opportunity? by Baruch Sadogursky, JFrog
Docker Meetup Paris: enterprise Docker
Security Patterns for Microservice Architectures - SpringOne 2020
Security Patterns for Microservice Architectures
Docker in Continuous Integration
Dockercon EU 2014
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
DockerCon EU 2015: Day 1 General Session
Docker from A to Z, including Swarm and OCCS
Accelerate your software development with Docker
Accelerate your development with Docker
LXC to Docker Via Continuous Delivery
Containerize All the (Multi-Platform) Things! by Phil Estes
Ad

More from Baruch Sadogursky (20)

PDF
DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...
PDF
DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...
PDF
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...
PDF
Data driven devops as presented at QCon London 2018
PDF
A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018
PDF
Java Puzzlers NG S03 a DevNexus 2018
PDF
Where the Helm are your binaries? as presented at Canada Kubernetes Meetups
PDF
Data driven devops as presented at Codemash 2018
PDF
A Research Study into DevOps Bottlenecks as presented at Codemash 2018
PDF
Troubleshooting & Debugging Production Microservices in Kubernetes as present...
PDF
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
PPTX
Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...
PDF
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...
PDF
Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...
PDF
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...
PDF
Let’s Wing It: A Study in DevRel Strategy
PDF
Log Driven First Class Customer Support at Scale
PPTX
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
PDF
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
PDF
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Gr8Conf 2017
DevOps Patterns & Antipatterns for Continuous Software Updates @ NADOG April ...
DevOps Patterns & Antipatterns for Continuous Software Updates @ DevOps.com A...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Oracle Code NY...
Data driven devops as presented at QCon London 2018
A Research Study Into DevOps Bottlenecks as presented at Oracle Code LA 2018
Java Puzzlers NG S03 a DevNexus 2018
Where the Helm are your binaries? as presented at Canada Kubernetes Meetups
Data driven devops as presented at Codemash 2018
A Research Study into DevOps Bottlenecks as presented at Codemash 2018
Troubleshooting & Debugging Production Microservices in Kubernetes as present...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
Amazon Alexa Skills vs Google Home Actions, the Big Java VUI Faceoff as prese...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at DevOps Days Be...
Java Puzzlers NG S02: Down the Rabbit Hole as it was presented at The Pittsbu...
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at The Pittsburgh...
Let’s Wing It: A Study in DevRel Strategy
Log Driven First Class Customer Support at Scale
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
Groovy Puzzlers S04: The Bytecode Bites Back at Gr8Conf US 2017
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Gr8Conf 2017
Ad

Recently uploaded (20)

PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation theory and applications.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Machine learning based COVID-19 study performance prediction
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Electronic commerce courselecture one. Pdf
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation theory and applications.pdf
A Presentation on Artificial Intelligence
NewMind AI Monthly Chronicles - July 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Machine learning based COVID-19 study performance prediction
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Dropbox Q2 2025 Financial Results & Investor Presentation
MYSQL Presentation for SQL database connectivity
Review of recent advances in non-invasive hemoglobin estimation
Network Security Unit 5.pdf for BCA BBA.
Unlocking AI with Model Context Protocol (MCP)
Understanding_Digital_Forensics_Presentation.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
“AI and Expert System Decision Support & Business Intelligence Systems”
Electronic commerce courselecture one. Pdf

Best Practices for Managing Docker Versions as presented at JavaOne 2017

Editor's Notes

  • #12: BOM (Bills of Material) – Software name. 5 items