SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
Docker: Advanced 
registry usage 
September 17th, 2014 in Freiburg
Contents 
1. What’s a registry? 
2. Advanced configuration 
a. Search index 
b. Mirroring 
c. Adding a redis cache 
d. More! 
3. Extending the code
What’s a registry? 
• Storage component for docker images 
• Open-source python app 
• docker/docker-registry on github 
• Current stable version: 0.8.1 
• Available as an official image 
docker run -d -p 5000:5000 registry:0.8.1
What’s a registry? 
• Several storage backends supported 
• Filesystem 
• Boto (S3, Google Compute, ...) 
• OpenStack Swift
Advanced configuration 
The registry image is great for quick setup and testing, but 
we can make it even better with some tinkering! 
• Enabling search 
• Mirroring another registry (even the official one!) 
• Adding a redis cache 
• And more!
Search index 
Enabling a basic search index is easy! 
docker run -d -p 5000:5000 -e 
SEARCH_BACKEND=sqlalchemy registry:0.8.1
Search index 
Let’s put our SQLite database in a volume. 
docker run -d -p 5000:5000 
-e SEARCH_BACKEND=sqlalchemy 
-e SQLALCHEMY_INDEX_DATABASE=sqlite:////opt/sqlitedb/reg.db 
-v /opt/sqlitedb:/opt/sqlitedb 
registry:0.8.1
Search index 
Also, we want to keep our image store persistent across 
restarts! 
docker run -d -p 5000:5000 
-e SEARCH_BACKEND=sqlalchemy 
-e SQLALCHEMY_INDEX_DATABASE=sqlite:////opt/sqlitedb/reg.db 
-e STORAGE_PATH=/opt/registry 
-v /opt/registry/storage:/opt/registry 
-v /opt/sqlitedb:/opt/sqlitedb 
registry:0.8.1
Search index 
This is quite a mouthful... Let’s make a Dockerfile instead. 
$ docker build -t myregistry . 
$ docker run -d -p 5000:5000 -v 
/opt/registry/storage:/opt/registry -v 
/opt/registry/index:/opt/sqlitedb myregistry 
That’s better!
Search index 
Don’t like SQLite? That’s fine too!
Mirroring 
Having a local copy of commonly used images can be very 
helpful!
Mirroring 
“Standard“ method: 
$ docker pull busybox:latest 
$ docker tag busybox:latest myregistry. 
com/busybox:latest 
$ docker push myregistry.com/busybox:latest 
$ docker pull busybox:buildroot-2014.02 
...
Mirroring 
Better method: Enable mirroring on your registry! 
ENV MIRROR_SOURCE https://registry-1.docker.io 
ENV MIRROR_SOURCE_INDEX https://index.docker.io
Mirroring 
• On the first pull, immutable data (metadata, layers, 
image ancestry) is stored locally on the mirror. 
• The source is always contacted to retrieve mutable data 
(list of tags, <tag / image ID> mappings)... 
• ... unless you enable the redis cache, then tag data is 
kept for some time. 
• Set MIRROR_TAGS_CACHE_TTL accordingly!
Adding a redis cache 
First let’s start up a redis container. 
$ docker run --name rediscache -d redis:2.8.13 
Then we’re going to edit config/config_sample.yml 
cache: 
host: _env:REDISCACHE_PORT_6379_TCP_ADDR 
port: _env:REDISCACHE_PORT_6379_TCP_PORT 
db: 0 
cache_lru: 
host: _env:REDISCACHE_PORT_6379_TCP_ADDR 
port: _env:REDISCACHE_PORT_6379_TCP_PORT 
db: 1
Adding a redis cache 
• Copy the config_sample.yml file where our Dockerfile 
from before is. 
• Add the following line to our Dockerfile: 
ADD ./config_sample.yml /docker-registry/ 
config/config_sample.yml 
• Create a link with our rediscache container when 
starting up the registry 
docker run -d -p 5000:5000 --link rediscache:rediscache 
-v /opt/registry/storage:/opt/registry -v 
/opt/registry/index:/opt/sqlitedb myregistry
Adding a redis cache 
• Create a link with our rediscache container when 
starting up the registry 
docker run -d -p 5000:5000 --link rediscache:rediscache 
-v /opt/registry/storage:/opt/registry -v 
/opt/registry/index:/opt/sqlitedb myregistry 
• All set!
More configuration! 
• Use an nginx or Apache frontend to enforce basic auth. 
• You can then do: docker login my.registry.com 
• Only works over HTTPS! 
• Enable e-mail notifications when an exception is 
encountered 
• See the email_notifications section of the 
configuration
Extending the code 
• You’ll need time and some Python proficiency. 
• But for advanced usage, it can be worth it! 
• If you make something cool, think about giving back to the 
community! We accept pull requests.
Extending the code 
• You can implement a new storage driver by inheriting 
docker_registry.core.driver.Base 
• Leverage the signals API in docker_registry.lib.signals 
• Implement a new search backend by inheriting 
docker_registry.lib.index.Index 
• Other ideas? Talk to us, let us know if we can help!
• Code: github.com/docker/docker-registry 
• DockerHub: registry.hub.docker.com/_/registry 
• Contact me: 
• Twitter @j0ffrey 
• GitHub @shin- 
• E-mail joffrey@docker.com 
THANK YOU! 
Resources

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Kubernetes
KubernetesKubernetes
Kubernetes
 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
 
Intro to docker
Intro to dockerIntro to docker
Intro to docker
 
Docker intro
Docker introDocker intro
Docker intro
 
PrĂŠsentation docker et kubernetes
PrĂŠsentation docker et kubernetesPrĂŠsentation docker et kubernetes
PrĂŠsentation docker et kubernetes
 
Docker: From Zero to Hero
Docker: From Zero to HeroDocker: From Zero to Hero
Docker: From Zero to Hero
 
kubernetes, pourquoi et comment
kubernetes, pourquoi et commentkubernetes, pourquoi et comment
kubernetes, pourquoi et comment
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
What is Docker
What is DockerWhat is Docker
What is Docker
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Getting Started with Kubernetes
Getting Started with Kubernetes Getting Started with Kubernetes
Getting Started with Kubernetes
 
Intro docker
Intro dockerIntro docker
Intro docker
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
Docker Explained | What Is A Docker Container? | Docker Simplified | Docker T...
 
Docker
DockerDocker
Docker
 
Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)
 
Docker Networking Overview
Docker Networking OverviewDocker Networking Overview
Docker Networking Overview
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Docker swarm introduction
Docker swarm introductionDocker swarm introduction
Docker swarm introduction
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 

Ähnlich wie Docker Advanced registry usage

How to Use Your Own Private Registry
How to Use Your Own Private RegistryHow to Use Your Own Private Registry
How to Use Your Own Private Registry
Docker, Inc.
 
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
Mihai Criveti
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
Hannes Hapke
 
A new model for Docker image distribution
A new model for Docker image distributionA new model for Docker image distribution
A new model for Docker image distribution
Docker, Inc.
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
LeanDog
 

Ähnlich wie Docker Advanced registry usage (20)

Docker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registryDocker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registry
 
How to Use Your Own Private Registry
How to Use Your Own Private RegistryHow to Use Your Own Private Registry
How to Use Your Own Private Registry
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, OrchestrationThe Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
 
Docker 102 - Immutable Infrastructure
Docker 102 - Immutable InfrastructureDocker 102 - Immutable Infrastructure
Docker 102 - Immutable Infrastructure
 
PDXPortland - Dockerize Django
PDXPortland - Dockerize DjangoPDXPortland - Dockerize Django
PDXPortland - Dockerize Django
 
DevOPS training - Day 2/2
DevOPS training - Day 2/2DevOPS training - Day 2/2
DevOPS training - Day 2/2
 
Package your Java EE Application using Docker and Kubernetes
Package your Java EE Application using Docker and KubernetesPackage your Java EE Application using Docker and Kubernetes
Package your Java EE Application using Docker and Kubernetes
 
Getting Started with Docker
Getting Started with DockerGetting Started with Docker
Getting Started with Docker
 
Dockercon EU 2014
Dockercon EU 2014Dockercon EU 2014
Dockercon EU 2014
 
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
 
habitat at docker bud
habitat at docker budhabitat at docker bud
habitat at docker bud
 
A new model for Docker image distribution
A new model for Docker image distributionA new model for Docker image distribution
A new model for Docker image distribution
 
ITB2017 - Keynote
ITB2017 - KeynoteITB2017 - Keynote
ITB2017 - Keynote
 
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on AzureDocker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
Docker Seattle Meetup April 2015 - The Docker Orchestration Ecosystem on Azure
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
Docker for Ruby Developers
Docker for Ruby DevelopersDocker for Ruby Developers
Docker for Ruby Developers
 
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
Docker New York Meetup May 2015 - The Docker Orchestration Ecosystem on Azure
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
 

Mehr von Docker, Inc.

Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
Docker, Inc.
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
Docker, Inc.
 

Mehr von Docker, Inc. (20)

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

KĂźrzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

KĂźrzlich hochgeladen (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Docker Advanced registry usage

  • 1. Docker: Advanced registry usage September 17th, 2014 in Freiburg
  • 2. Contents 1. What’s a registry? 2. Advanced configuration a. Search index b. Mirroring c. Adding a redis cache d. More! 3. Extending the code
  • 3. What’s a registry? • Storage component for docker images • Open-source python app • docker/docker-registry on github • Current stable version: 0.8.1 • Available as an official image docker run -d -p 5000:5000 registry:0.8.1
  • 4. What’s a registry? • Several storage backends supported • Filesystem • Boto (S3, Google Compute, ...) • OpenStack Swift
  • 5. Advanced configuration The registry image is great for quick setup and testing, but we can make it even better with some tinkering! • Enabling search • Mirroring another registry (even the official one!) • Adding a redis cache • And more!
  • 6. Search index Enabling a basic search index is easy! docker run -d -p 5000:5000 -e SEARCH_BACKEND=sqlalchemy registry:0.8.1
  • 7. Search index Let’s put our SQLite database in a volume. docker run -d -p 5000:5000 -e SEARCH_BACKEND=sqlalchemy -e SQLALCHEMY_INDEX_DATABASE=sqlite:////opt/sqlitedb/reg.db -v /opt/sqlitedb:/opt/sqlitedb registry:0.8.1
  • 8. Search index Also, we want to keep our image store persistent across restarts! docker run -d -p 5000:5000 -e SEARCH_BACKEND=sqlalchemy -e SQLALCHEMY_INDEX_DATABASE=sqlite:////opt/sqlitedb/reg.db -e STORAGE_PATH=/opt/registry -v /opt/registry/storage:/opt/registry -v /opt/sqlitedb:/opt/sqlitedb registry:0.8.1
  • 9. Search index This is quite a mouthful... Let’s make a Dockerfile instead. $ docker build -t myregistry . $ docker run -d -p 5000:5000 -v /opt/registry/storage:/opt/registry -v /opt/registry/index:/opt/sqlitedb myregistry That’s better!
  • 10. Search index Don’t like SQLite? That’s fine too!
  • 11. Mirroring Having a local copy of commonly used images can be very helpful!
  • 12. Mirroring “Standard“ method: $ docker pull busybox:latest $ docker tag busybox:latest myregistry. com/busybox:latest $ docker push myregistry.com/busybox:latest $ docker pull busybox:buildroot-2014.02 ...
  • 13. Mirroring Better method: Enable mirroring on your registry! ENV MIRROR_SOURCE https://registry-1.docker.io ENV MIRROR_SOURCE_INDEX https://index.docker.io
  • 14. Mirroring • On the first pull, immutable data (metadata, layers, image ancestry) is stored locally on the mirror. • The source is always contacted to retrieve mutable data (list of tags, <tag / image ID> mappings)... • ... unless you enable the redis cache, then tag data is kept for some time. • Set MIRROR_TAGS_CACHE_TTL accordingly!
  • 15. Adding a redis cache First let’s start up a redis container. $ docker run --name rediscache -d redis:2.8.13 Then we’re going to edit config/config_sample.yml cache: host: _env:REDISCACHE_PORT_6379_TCP_ADDR port: _env:REDISCACHE_PORT_6379_TCP_PORT db: 0 cache_lru: host: _env:REDISCACHE_PORT_6379_TCP_ADDR port: _env:REDISCACHE_PORT_6379_TCP_PORT db: 1
  • 16. Adding a redis cache • Copy the config_sample.yml file where our Dockerfile from before is. • Add the following line to our Dockerfile: ADD ./config_sample.yml /docker-registry/ config/config_sample.yml • Create a link with our rediscache container when starting up the registry docker run -d -p 5000:5000 --link rediscache:rediscache -v /opt/registry/storage:/opt/registry -v /opt/registry/index:/opt/sqlitedb myregistry
  • 17. Adding a redis cache • Create a link with our rediscache container when starting up the registry docker run -d -p 5000:5000 --link rediscache:rediscache -v /opt/registry/storage:/opt/registry -v /opt/registry/index:/opt/sqlitedb myregistry • All set!
  • 18. More configuration! • Use an nginx or Apache frontend to enforce basic auth. • You can then do: docker login my.registry.com • Only works over HTTPS! • Enable e-mail notifications when an exception is encountered • See the email_notifications section of the configuration
  • 19. Extending the code • You’ll need time and some Python proficiency. • But for advanced usage, it can be worth it! • If you make something cool, think about giving back to the community! We accept pull requests.
  • 20. Extending the code • You can implement a new storage driver by inheriting docker_registry.core.driver.Base • Leverage the signals API in docker_registry.lib.signals • Implement a new search backend by inheriting docker_registry.lib.index.Index • Other ideas? Talk to us, let us know if we can help!
  • 21. • Code: github.com/docker/docker-registry • DockerHub: registry.hub.docker.com/_/registry • Contact me: • Twitter @j0ffrey • GitHub @shin- • E-mail joffrey@docker.com THANK YOU! Resources