Overview

This topic reviews how to configure Azure Blob Storage for OpenShift integrated Docker registry.

Before You Begin

  • Create a storage container using Microsoft Azure Portal, Microsoft Azure CLI, or Microsoft Azure Storage Explorer. Keep a note of the storage account name, storage account key and container name.

  • Deploy the integrated Docker registry if it is not deployed.

Overriding Registry Configuration

To create a new registry pod and replace the old pod automatically:

  1. Create a new registry configuration file called registryconfig.yaml and add the following information:

      version: 0.1
      log:
        level: debug
      http:
        addr: :5000
      storage:
        cache:
          blobdescriptor: inmemory
        delete:
          enabled: true
        azure: (1)
          accountname: azureblobacc
          accountkey:  azureblobacckey
          container: azureblobname
      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
    1 Replace the values for accountname, acountkey, and container with storage account name, storage account key, and storage container name respectively.
  2. Create a new registry configuration:

    $ oc secrets new registry-config config.yaml=registryconfig.yaml
  3. Add the secret:

    $ oc volume dc/docker-registry --add --type=secret \
        --secret-name=registry-config -m /etc/docker/registry/
  4. Set the REGISTRY_CONFIGURATION_PATH environment variable:

    $ oc set env dc/docker-registry \
        REGISTRY_CONFIGURATION_PATH=/etc/docker/registry/config.yaml
  5. If you already created a registry configuration:

    1. Delete the secret:

      $ oc delete secret registry-config
    2. Create a new registry configuration:

      $ oc secrets new registry-config config.yaml=registryconfig.yaml
    3. Update the configuration by starting a new rollout:

      $ oc rollout latest docker-registry