Caching
Caching Demos
Caching Limitations
Caching Other Registries
Caching Gitlab Demo
Mirroring
Manual Mirroring
Summary
Agenda
@sudo_bmitch1 / 35
        
How to Use Mirroring and
Caching to Optimize Your
Image Registry
Brandon Mitchell
Twitter: @sudo_bmitch
GitHub: sudo-bmitch
2 / 35
Ephemeral Build Server?
@sudo_bmitch3 / 35
Cluster Pulling Remote Images?
@sudo_bmitch4 / 35
Worry About Upstream Image Changes?
@sudo_bmitch5 / 35
Build and Deploy Infrastructure Tolerant of
Upstream Outages?
@sudo_bmitch6 / 35
Production Resilience
@sudo_bmitch7 / 35
Build Infrastructure
@sudo_bmitch8 / 35
Build Outage
@sudo_bmitch9 / 35
Build Resilience
@sudo_bmitch10 / 35
Faster Builds and Less Bandwidth
@sudo_bmitch11 / 35
Caching
@sudo_bmitch12 / 35
Caching is the Easy Button
https://commons.wikimedia.org/wiki/File:Easy_button.JPG
@sudo_bmitch13 / 35
Cache Architecture
@sudo_bmitch14 / 35
Cache Implementation
Either the dockerd CLI:
dockerd --registry-mirror <cache-url>
Or /etc/docker/daemon.json
{ "registry-mirrors": [ "<cache-url>" ] }
Plus a registry:
docker run -e REGISTRY_PROXY_REMOTEURL=<upstream-url> registry:2
@sudo_bmitch15 / 35
@sudo_bmitch
00:00
16 / 35
@sudo_bmitch
00:00
17 / 35
@sudo_bmitch
00:00
18 / 35
@sudo_bmitch
00:00
19 / 35
@sudo_bmitch
00:00
20 / 35
So What's the Catch?
@sudo_bmitch21 / 35
Cache Limitations
The "registry-mirror" setting only applies to Docker Hub
Only caches pulls not pushes
Pulls still check the image manifest on Hub
Credentials are in the cache server
Docker implementation only supports one authentication method
@sudo_bmitch22 / 35
Options to Cache Other Registries
Con gure a squid HTTP caching proxy
Pull directly from the cache
Use DNS and TLS certs to send pulls to the proxy
@sudo_bmitch23 / 35
@sudo_bmitch
00:00
24 / 35
I Want More
@sudo_bmitch25 / 35
Mirroring
@sudo_bmitch26 / 35
Mirror Architecture
@sudo_bmitch27 / 35
Running a Registry
Docker image
docker container run -p 5000:5000 registry:2
Harbor
Many Artifact Repositories
@sudo_bmitch28 / 35
Manually Mirroring
docker image pull ${image}
docker image tag ${image} local-mirror:5000/${image}
docker image push local-mirror:5000/${image}
@sudo_bmitch29 / 35
Manual Mirror Script
docker image pull "$localimg"
docker image pull "$remoteimg"
remoteid=$(docker image inspect "$remoteimg" --format '{.Id}')
localid=$(docker image inspect "$localimg" --format '{.Id}')
if [ "$remoteid" != "$localid" ]; then
docker image tag "$localimg" "$localimg.$datestamp"
docker image tag "$remoteimg" "$localimg"
docker image push "$localimg.$datestamp"
docker image push "$localimg"
fi
@sudo_bmitch30 / 35
Why All the Complication?
@sudo_bmitch31 / 35
Advantages of Manually Mirroring
Over Automatically Syncing Repos:
Changes to images happen on your schedule
Backout option exists with breaking changes
Over Pull Through Cache
Those reasons plus...
Pushing locally built images to the registry
Upstream outage doesn't stop local builds/deploys
@sudo_bmitch32 / 35
Risks of Manually Mirroring
Images go stale if you do not automate the script
Adding new images is an added process
Recovering from a mirror outage requires populating images
FROM line in images needs to point to mirror
ARG REGISTRY=docker.io
FROM ${REGISTRY}/alpine:3.9
...
docker build --build-arg REGISTRY=local-mirror:5000 .
@sudo_bmitch33 / 35
Summary
Both
Saves bandwidth
Faster builds
Pull Through Cache
Easy to create
Little maintenance
Managed Mirror
Control changes
Tolerate upstream outages
@sudo_bmitch34 / 35
Brandon Mitchell
Twitter: @sudo_bmitch
GitHub: sudo-bmitch
Thank You
github.com/sudo-bmitch/presentations
35 / 35

More Related Content

PDF
Managing ESXi - Tools and Techniques
DOCX
SAP Security interview questions
PPTX
Les System de Gestion de Base de Données
PDF
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
PDF
Alphorm.com Formation Windows Server 2019 : Installation et Configuration de ...
PDF
Anil kumar sap security & GRC
PPTX
Microsoft Offical Course 20410C_00
Managing ESXi - Tools and Techniques
SAP Security interview questions
Les System de Gestion de Base de Données
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Alphorm.com Formation Windows Server 2019 : Installation et Configuration de ...
Anil kumar sap security & GRC
Microsoft Offical Course 20410C_00

What's hot (6)

PPT
Server virtualization by VMWare
PDF
Container Security Deep Dive & Kubernetes
DOC
sap security interview_questions
PDF
Openstack pour les nuls
PPTX
DevOps with Kubernetes
PDF
Aruba Instant 6.4.0.2-4.1 Command Line Interface Reference Guide
Server virtualization by VMWare
Container Security Deep Dive & Kubernetes
sap security interview_questions
Openstack pour les nuls
DevOps with Kubernetes
Aruba Instant 6.4.0.2-4.1 Command Line Interface Reference Guide
Ad

Similar to How to Use Mirroring and Caching to Optimize your Container Registry (20)

PDF
Docker primer and tips
PDF
Docker off the grid
PPTX
"Docker best practice", Станислав Коленкин (senior devops, DataArt)
PDF
Common primitives in Docker environments
PDF
Docker for developers
PDF
Real-World Docker: 10 Things We've Learned
PDF
Shipping NodeJS with Docker and CoreOS
PDF
Docker at ACCU2015
PDF
Docker Best Practices Workshop
PDF
OSDC 2014: Tobias Schwab - Continuous Delivery with Docker
PPTX
Virtualization, Containers, Docker and scalable container management services
PDF
Up and running with docker
PDF
Docker 0.11 at MaxCDN meetup in Los Angeles
PPSX
Containers Docker Kind Kubernetes Istio
PPTX
Taking Docker to Dance: Continuous Delivery on AWS
PDF
Introduction to Docker
PPTX
Docker for developers z java
PDF
Perspectives on Docker
PDF
Docker From Scratch
PPT
Containers 101
Docker primer and tips
Docker off the grid
"Docker best practice", Станислав Коленкин (senior devops, DataArt)
Common primitives in Docker environments
Docker for developers
Real-World Docker: 10 Things We've Learned
Shipping NodeJS with Docker and CoreOS
Docker at ACCU2015
Docker Best Practices Workshop
OSDC 2014: Tobias Schwab - Continuous Delivery with Docker
Virtualization, Containers, Docker and scalable container management services
Up and running with docker
Docker 0.11 at MaxCDN meetup in Los Angeles
Containers Docker Kind Kubernetes Istio
Taking Docker to Dance: Continuous Delivery on AWS
Introduction to Docker
Docker for developers z java
Perspectives on Docker
Docker From Scratch
Containers 101
Ad

More from Docker, Inc. (20)

PDF
Containerize Your Game Server for the Best Multiplayer Experience
PDF
How to Improve Your Image Builds Using Advance Docker Build
PDF
Build & Deploy Multi-Container Applications to AWS
PDF
Securing Your Containerized Applications with NGINX
PDF
How To Build and Run Node Apps with Docker and Compose
PDF
Hands-on Helm
PDF
Distributed Deep Learning with Docker at Salesforce
PDF
The First 10M Pulls: Building The Official Curl Image for Docker Hub
PDF
Monitoring in a Microservices World
PDF
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
PDF
Predicting Space Weather with Docker
PDF
Become a Docker Power User With Microsoft Visual Studio Code
PDF
Monolithic to Microservices + Docker = SDLC on Steroids!
PDF
Kubernetes at Datadog Scale
PDF
Labels, Labels, Labels
PDF
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
PDF
Build & Deploy Multi-Container Applications to AWS
PDF
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
PDF
Developing with Docker for the Arm Architecture
PDF
Sharing is Caring: How to Begin Speaking at Conferences
Containerize Your Game Server for the Best Multiplayer Experience
How to Improve Your Image Builds Using Advance Docker Build
Build & Deploy Multi-Container Applications to AWS
Securing Your Containerized Applications with NGINX
How To Build and Run Node Apps with Docker and Compose
Hands-on Helm
Distributed Deep Learning with Docker at Salesforce
The First 10M Pulls: Building The Official Curl Image for Docker Hub
Monitoring in a Microservices World
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
Predicting Space Weather with Docker
Become a Docker Power User With Microsoft Visual Studio Code
Monolithic to Microservices + Docker = SDLC on Steroids!
Kubernetes at Datadog Scale
Labels, Labels, Labels
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Build & Deploy Multi-Container Applications to AWS
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
Developing with Docker for the Arm Architecture
Sharing is Caring: How to Begin Speaking at Conferences

Recently uploaded (20)

PDF
Lung cancer patients survival prediction using outlier detection and optimize...
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
PDF
giants, standing on the shoulders of - by Daniel Stenberg
PPTX
MuleSoft-Compete-Deck for midddleware integrations
PDF
Electrocardiogram sequences data analytics and classification using unsupervi...
PDF
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PDF
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf
PDF
LMS bot: enhanced learning management systems for improved student learning e...
PDF
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
PDF
Advancing precision in air quality forecasting through machine learning integ...
PPTX
Microsoft User Copilot Training Slide Deck
PPTX
Internet of Everything -Basic concepts details
PPTX
Build automations faster and more reliably with UiPath ScreenPlay
PDF
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
PDF
4 layer Arch & Reference Arch of IoT.pdf
PPTX
Training Program for knowledge in solar cell and solar industry
Lung cancer patients survival prediction using outlier detection and optimize...
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
NewMind AI Weekly Chronicles – August ’25 Week IV
giants, standing on the shoulders of - by Daniel Stenberg
MuleSoft-Compete-Deck for midddleware integrations
Electrocardiogram sequences data analytics and classification using unsupervi...
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
Data Virtualization in Action: Scaling APIs and Apps with FME
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf
LMS bot: enhanced learning management systems for improved student learning e...
5-Ways-AI-is-Revolutionizing-Telecom-Quality-Engineering.pdf
Advancing precision in air quality forecasting through machine learning integ...
Microsoft User Copilot Training Slide Deck
Internet of Everything -Basic concepts details
Build automations faster and more reliably with UiPath ScreenPlay
Dell Pro Micro: Speed customer interactions, patient processing, and learning...
4 layer Arch & Reference Arch of IoT.pdf
Training Program for knowledge in solar cell and solar industry

How to Use Mirroring and Caching to Optimize your Container Registry