Silver Light and Blue Sky

C# and Infrastructure. Code is everything.

Set up Azure Blob Storage for docker registry storage

Following my previous post, I’m explaining how to use Azure Blob Storage for OpenShift internal docker registry storage.

tech.en.tanaka733.net

By default, OpenShift internal docker registry uses an ephemeral disk for storage. However, you can use Azure Blob Storage for docker registry storage.

Deploying a Registry on Existing Clusters - Setting up the Registry | Installation and Configuration | OpenShift Container Platform 3.5

This technology depends on Azure storage driver for Docker.

docs.docker.com

You can set up Azure Blob Storage in advance. You should retrieve storage account name and storage account key.

f:id:tanaka733:20170812050656p:plain

And you should create a container for the registry.

f:id:tanaka733:20170812050912p:plain

Now, save below yaml file as a registry-config.yaml. Please replace <***> with your Azure Blob container values.

version: 0.1
log:
  level: debug
http:
  addr: :5000
storage:
  cache:
    blobdescriptor: inmemory
  delete:
    enabled: true
  azure:
    accountname: <storage_account_name>
    accountkey: <storage_account_key>
    container: <storage_container_name>
auth:
  openshift:
    realm: openshift
middleware:
  registry:
    - name: openshift
  repository:
    - name: openshift
      options:
        acceptschema2: false
        pullthrough: true
        enforcequota: false
        projectcachettl: 1m
        blobrepositorycachettl: 10m
  storage:
    - name: openshift

Execute below commands as cluster-admin.

$ oc secrets new registry-config config.yml=registry-config.yaml
$ oc volume dc/docker-registry --add --type=secret \
    --secret-name=registry-config -m /etc/docker/registry/
$ oc set env dc/docker-registry \
    REGISTRY_CONFIGURATION_PATH=/etc/docker/registry/config.yml

Now new registry pod will be running with Azure Blob storage.