Registry 設定リファレンス

Registry の設定は YAML 形式のファイルをベースとしており、詳細は以下をご覧ください。特に気にしなくても適切な初期値が設定されています。そのため、システムをプロダクションに移行する場合、多大なレビューをしなくても良いでしょう。

設定オプションの上書き指定

Registry の 一般的なセットアップは公式イメージを使う方法です。 docker run を実行する時、 -e オプションを使うことで環境変数を通した設定が可能となります。あるいは、 Dockerfile の中で ENV 命令を使うこともできます。

設定オプションを上書きするには、 REGISTRY_変数変数 にあたる設定オプションを使います。そして _ (アンダースコア)は階層レベルを表します。例えば、filesystem ストレージ・バックエンドの rootdirecty を次のように指定しているとします。

storage:
  filesystem:
    rootdirectory: /var/lib/registry

これを環境変数で上書きするには、次の形式で実行します。

REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/somewhere

この指定を行うと、/var/lib/registry の値は /somewhere ディレクトリに上書きします。

注釈

細かな値を調整するためには、環境変数を記述した設定ファイルをベースに(registry コンテナを)起動するのを強く推奨します。環境変数で設定を変更するのは推奨されない手法です。

設定ファイルの項目を上書き

デフォルトの設定では(Registryのコンテナ用)イメージが実行できないか、あるいは環境変数の指定で問題が起こるかもしれません。そのような場合はコンテナのボリュームとして別の設定用 YAML ファイルを指定できます。

一般的には、新しい設定ファイルはスクラッチで作成(ゼロから作成)します。それが config.yml であれば、次のように実行します。

docker run -d -p 5000:5000 --restart=always --name registry \
  -v `pwd`/config.yml:/etc/docker/registry/config.yml \
  registry:2

次のファイルが スタート地点(のサンプル設定用) として利用可能です(あるいは、使うべきでしょう)。

設定オプションの一覧

このセクションでは Registry 設定オプションの一覧を紹介します。オプションによっては相互に排他(どちらか1つしか指定不可)の場合があります。そのため、このページ後半にある各オプションのリファレンス詳細をご確認ください。

version: 0.1
log:
  level: debug
  formatter: text
  fields:
    service: registry
    environment: staging
  hooks:
    - type: mail
      disabled: true
      levels:
        - panic
      options:
        smtp:
          addr: mail.example.com:25
          username: mailuser
          password: password
          insecure: true
        from: sender@example.com
        to:
          - errors@example.com
loglevel: debug # deprecated: use "log"
storage:
  filesystem:
    rootdirectory: /var/lib/registry
  azure:
    accountname: accountname
    accountkey: base64encodedaccountkey
    container: containername
  gcs:
    bucket: bucketname
    keyfile: /path/to/keyfile
    rootdirectory: /gcs/object/name/prefix
  s3:
    accesskey: awsaccesskey
    secretkey: awssecretkey
    region: us-west-1
    bucket: bucketname
    encrypt: true
    secure: true
    v4auth: true
    chunksize: 5242880
    rootdirectory: /s3/object/name/prefix
  rados:
    poolname: radospool
    username: radosuser
    chunksize: 4194304
  swift:
    username: username
    password: password
    authurl: https://storage.myprovider.com/auth/v1.0 or https://storage.myprovider.com/v2.0 or https://storage.myprovider.com/v3/auth
    tenant: tenantname
    tenantid: tenantid
    domain: domain name for Openstack Identity v3 API
    domainid: domain id for Openstack Identity v3 API
    insecureskipverify: true
    region: fr
    container: containername
    rootdirectory: /swift/object/name/prefix
  oss:
    accesskeyid: accesskeyid
    accesskeysecret: accesskeysecret
    region: OSS region name
    endpoint: optional endpoints
    internal: optional internal endpoint
    bucket: OSS bucket
    encrypt: optional data encryption setting
    secure: optional ssl setting
    chunksize: optional size valye
    rootdirectory: optional root directory
  inmemory:  # This driver takes no parameters
  delete:
    enabled: false
  redirect:
    disable: false
  cache:
    blobdescriptor: redis
  maintenance:
    uploadpurging:
      enabled: true
      age: 168h
      interval: 24h
      dryrun: false
    readonly:
      enabled: false
auth:
  silly:
    realm: silly-realm
    service: silly-service
  token:
    realm: token-realm
    service: token-service
    issuer: registry-token-issuer
    rootcertbundle: /root/certs/bundle
  htpasswd:
    realm: basic-realm
    path: /path/to/htpasswd
middleware:
  registry:
    - name: ARegistryMiddleware
      options:
        foo: bar
  repository:
    - name: ARepositoryMiddleware
      options:
        foo: bar
  storage:
    - name: cloudfront
      options:
        baseurl: https://my.cloudfronted.domain.com/
        privatekey: /path/to/pem
        keypairid: cloudfrontkeypairid
        duration: 3000
reporting:
  bugsnag:
    apikey: bugsnagapikey
    releasestage: bugsnagreleasestage
    endpoint: bugsnagendpoint
  newrelic:
    licensekey: newreliclicensekey
    name: newrelicname
    verbose: true
http:
  addr: localhost:5000
  prefix: /my/nested/registry/
  host: https://myregistryaddress.org:5000
  secret: asecretforlocaldevelopment
  tls:
    certificate: /path/to/x509/public
    key: /path/to/x509/private
    clientcas:
      - /path/to/ca.pem
      - /path/to/another/ca.pem
  debug:
    addr: localhost:5001
  headers:
    X-Content-Type-Options: [nosniff]
notifications:
  endpoints:
    - name: alistener
      disabled: false
      url: https://my.listener.com/event
      headers: <http.Header>
      timeout: 500
      threshold: 5
      backoff: 1000
redis:
  addr: localhost:6379
  password: asecret
  db: 0
  dialtimeout: 10ms
  readtimeout: 10ms
  writetimeout: 10ms
  pool:
    maxidle: 16
    maxactive: 64
    idletimeout: 300s
health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3
  file:
    - file: /path/to/checked/file
      interval: 10s
  http:
    - uri: http://server.to.check/must/return/200
      headers:
        Authorization: [Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==]
      statuscode: 200
      timeout: 3s
      interval: 10s
      threshold: 3
  tcp:
    - addr: redis-server.domain.com:6379
      timeout: 3s
      interval: 10s
      threshold: 3
proxy:
  remoteurl: https://registry-1.docker.io
  username: [username]
  password: [password]
compatibility:
  schema1:
    signingkeyfile: /etc/registry/key.json
    disablesignaturestore: true

設定オプションのいくつかは オプション ですが、子オプションの中には 必須 な場合があります。つまり子オプションによっては元のオプションを省略できます。しかしながら、親に含まれていても、それが子オプションでも 必須 になっている場合があります。

version

version: 0.1

version オプションは 必須 です。これは設定ファイルのバージョンを指定します。トップ・レベルのフィールドに書くべきです。これは、以降の設定ファイルを処理する前に、バージョン確認を行えるようにするためです。

log

log サブセクションはロギング・システムの動作を設定します。ロギング・システムは全ての標準出力の情報を書き出します。このセクションで、必要に応じてログの粒度や形式を指定できミズ会う。

log:
  level: debug
  formatter: text
  fields:
    service: registry
    environment: staging
パラメータ 必須 説明
level いいえ ログ出力のレベル(度合い)を設定します。利用可能な値は errorwarninfodebug です。デフォルトは info です。
formatter いいえ ログの出力形式を指定します。ログの各行をどのような形式で出力するかを決めます。オプションは textjsonlogstash です。デフォルトは text です。
fields いいえ フィールド名を値に割り当て(マップ)します。ログ内容の各行に追加します。これが役立つのは、複数のシステムを混在させるとき、元になった環境を識別する場合です。

hooks

hooks:
  - type: mail
    levels:
      - panic
    options:
      smtp:
        addr: smtp.sendhost.com:25
        username: sendername
        password: password
        insecure: true
      from: name@sendhost.com
      to:
        - name@receivehost.com

hooks サブセクションは、ログをフックする挙動を指定します。このサブセクション例ではシーケンス・ハンドラを指定し、メールを送信する命令を設定しています。出力されるメッセージのレベルについては loglevel をご覧ください。

loglevel

警告

廃止予定:代わりに log をご覧ください。

loglevel: debug

ここでは errorwarninfodebug を指定できます。デフォルトは info です。

storage

storage:
  filesystem:
    rootdirectory: /var/lib/registry
  azure:
    accountname: accountname
    accountkey: base64encodedaccountkey
    container: containername
  gcs:
    bucket: bucketname
    keyfile: /path/to/keyfile
    rootdirectory: /gcs/object/name/prefix
  s3:
    accesskey: awsaccesskey
    secretkey: awssecretkey
    region: us-west-1
    bucket: bucketname
    encrypt: true
    secure: true
    v4auth: true
    chunksize: 5242880
    rootdirectory: /s3/object/name/prefix
  rados:
    poolname: radospool
    username: radosuser
    chunksize: 4194304
  swift:
    username: username
    password: password
    authurl: https://storage.myprovider.com/auth/v1.0 or https://storage.myprovider.com/v2.0 or https://storage.myprovider.com/v3/auth
    tenant: tenantname
    tenantid: tenantid
    domain: domain name for Openstack Identity v3 API
    domainid: domain id for Openstack Identity v3 API
    insecureskipverify: true
    region: fr
    container: containername
    rootdirectory: /swift/object/name/prefix
  oss:
    accesskeyid: accesskeyid
    accesskeysecret: accesskeysecret
    region: OSS region name
    endpoint: optional endpoints
    internal: optional internal endpoint
    bucket: OSS bucket
    encrypt: optional data encryption setting
    secure: optional ssl setting
    chunksize: optional size valye
    rootdirectory: optional root directory
  inmemory:
  delete:
    enabled: false
  cache:
    blobdescriptor: inmemory
  maintenance:
    uploadpurging:
      enabled: true
      age: 168h
      interval: 24h
      dryrun: false
  redirect:
    disable: false

ストレージのバックエンドに何を使うか定義する storage オプションは 必須 です。バックエンドに指定できるのは1つだけです。複数指定してもエラーになります。バックエンド・ストレージのドライバには、以下の項目が指定可能です。

  • filesystem : ローカルのディスク上にレジストリ用ファイルを保存します。開発環境や小規模のプロダクションに理想的でしょう。詳細は ドライバのリファレンス・ドキュメント をご覧ください。
  • azure : Microsoft Azure Blob ストレージを使います。詳細は ドライバのリファレンス・ドキュメント をご覧ください。
  • rados : Ceph オブジェクト・ストレージを使います。詳細は ドライバのリファレンス・ドキュメント をご覧ください。
  • s3 : Amazon の Simple Storage Service (S3) を使います。詳細は ドライバのリファレンス・ドキュメント をご覧ください。
  • swift : OpenStack Swift ストレージ・ドライバを使います。詳細は ドライバのリファレンス・ドキュメント をご覧ください。
  • oss : Aliyun Oss をオブジェクト・ストレージに使います。詳細は ドライバのリファレンス・ドキュメント をご覧ください。

純粋なテスト用途であれば、 inmemory (イン・メモリ) ストレージ・ドライバ を指定できます。これはレジストリを揮発性メモリ上で実行するものであり、RAM ディスク上で filesystem ドライバ を使います。

Registry を Windows にデプロイする場合は、ホスト上の Windows ボリュームのマウントは推奨されていないことにご注意ください。その代わり、 S3 や Azure といったデータストアを使えます。Windows ボリュームを使うのであれば、マウントポイントの PATH は Windows の MAX_PATH 上限(通常は 255 文字)以内に収める必要があります。失敗すると、次のようなメッセージが表示されます。

mkdir /XXX protocol error and your registry will not function properly.

maintenance

現時点では、メンテナンス機能としてアップロード・パージング(upload purging)とリードオンリー・モードが利用できます。これらはストレージに関連するメンテナンス機能を提供するもので、maintenance セクション以下で設定します。

アップロード・パージング

uploadpurging で指定するアップロード・パージング(upload purging)とは、Registry のアップロード対象のディレクトリから孤立したファイルを定期的に削除する処理です。デフォルトでアップロード・パージングは有効化されています。アップロード・ディレクトリのパージングを競ってするには、以下のパラメータ指定が必要です。

注釈

ageinterval の文字列にはオプションで単位を指定できます。例: 45m(45分)、2h10m(2時間10分)、168h(168時間=1週間)

リードオンリー・モード

maintenance 以下の readonly セクションにある enabledtrue に指定すると、クライアントから Registry へアップロードできなくなります。この処理はバックエンド・ストレージ上の整理をするとき、一時的に読み込み専用にしたい場合に便利です。整理を始める前に、Registry はリードオンリー設定の enabledtrue に指定します。整理が終われば Registry を再起動します。この時に設定ファイルから readonly を消します(あるいは false の値を指定します)。

delete

delete サブセクションはダイジェストを使ってイメージのかたまりとマニフェストを削除するために使います。デフォルトは false ですが、設定ファイルに次のような設定を書くと有効化できます。

delete:
  enabled: true

cache

cache サブセクションを使うとストレージ・バックエンドにアクセスするデータをキャッシュ可能にします。現時点で提供しているのは、レイヤのメタデータへのアクセスを早くするためのキャッシュのみです。設定するには blobdescriptor フィールドを使います。

blobdescriptor フィールドには redisinmemory を指定できます。値を redis にすると、レイヤ・メタデータのキャッシュに Redis プールを使います。値を inmemory にするとメモリを割り当てます。

注釈

blobdescriptor は、以前の layerinfo です。これらは同じものです。 layerinfo は廃止され、 blobdescriptor に移行しました。

redirect

redirect サブセクションはコンテント・バックエンドからのリダイレクトを管理する設定です。バックエンドがサポートしていれば、このリダイレクトはデフォルトで有効化されています。あるデプロイ・シナリオにおいて、全てのデータをバックエンドにリダイレクトするよりも、レジストリを通したほうが望ましい場合があります。バックエンドが同じ場所にない場合、あるいはレジストリ・インスタンスがキャッシュを必要としている場合には、より効果的にバックエンドを活用できる場合があるでしょう。

リダイレクトを無効化するには、 redirect セクション下にある disabletrue フラグをセットするだけです。

redirect:
  disable: true

auth

auth:
  silly:
    realm: silly-realm
    service: silly-service
  token:
    realm: token-realm
    service: token-service
    issuer: registry-token-issuer
    rootcertbundle: /root/certs/bundle
  htpasswd:
    realm: basic-realm
    path: /path/to/htpasswd

auth オプションは オプションです** 。認証(auth)プロバイダとして sillytokenhtpasswd の3種類を現時点では利用可能です。 auth プロバイダに指定できるのは、いずれか1つだけです。

silly

silly 認証は開発用途向けのみです。HTTP リクエストの中に Authorization が存在するかどうかのみ確認します。ヘッダの内容については確認しません。ヘッダが存在しなければ、 silly 認証はチャレンジ・レスポンスを応答し、強制的に realm または service を拒否した状態を返します。

応答には以下の値を設定できます。

パラメータ 必須 説明
realm はい レジストリ・サーバ認証は realm
service はい サービスが認証された状態

token

トークンをベースとした認証を使うことで、認証システムを Registry から切り離せます。高度なセキュリティを考慮した認証の枠組みを実現します。

パラメータ 必須 説明
realm はい レジストリ・サーバ認証は realm
service はい サービスが認証された状態
issuer はい トークン発行者(issue)の名前。発行者はこれをトークンの中に入れます。つまり、発行者が指定した値を一致する必要があります。
rootcertbundle はい ルート証明書群の絶対パスを指定します。ここには証明書の公開部分が含まれるもので、認証トークンの署名用に使います。

トークンをベースとした認証設定の更に詳しい情報は、 specification をご覧ください。

htpasswd

htpasswd 認証はバックエンドの認証に Apache の httpd ファイル を使ったベーシック認証を使います。 bcrypt 形式のパスワードのみサポートしています。ハッシュ・タイプのエントリは無視します。htpasswd ファイルは起動時に読み込みます。もしファイルが無効であれば、Registry はエラーを表示し、起動しません。

警告

この認証方式は TLS 設定と一緒に使用すべきです。何故なら、ベーシック認証はパスワード情報を http ヘッダの一部として送信するからです。

パラメータ 必須 説明
realm はい レジストリ・サーバ認証は realm
service はい サービスが認証された状態

middleware

middleware オプションは オプション です。このオプションはフック・ポイント(hook point)に投入するミドルウェアの名前指定に使います。全てのミドルウェアはラッピング可能なオブジェクトとして、同じインターフェースを使って実行する必要があります。つまりレジストリのミドルウェアは distribution.Namespace インターフェースとして実行する必要があり、リポジトリのミドルウェアは必ず distribution.Repository として実行する必要があり、また、ストレージ/ミドルウェアは driver.StorageDriver として実行する必要があります。

現時点でレジストリの実装上サポートされているのは cloudfront です。これは唯一利用可能なストレージ・ミドルウェアです。

middleware:
  registry:
    - name: ARegistryMiddleware
      options:
        foo: bar
  repository:
    - name: ARepositoryMiddleware
      options:
        foo: bar
  storage:
    - name: cloudfront
      options:
        baseurl: https://my.cloudfronted.domain.com/
        privatekey: /path/to/pem
        keypairid: cloudfrontkeypairid
        duration: 3000

各ミドルウェアのエントリは nameoptions エントリを持っています。 name は必須であり、ミドルウェア自身を登録するための名前に相当します。 options フィールドはミドルウェアの初期化時に何らかの設定が必要な場合、その詳細を指定します。ここでは map[文字列]interface{} の形式です。あるいは、必要であれば任意の構造の利用もサポートされています。どのような手法が望ましいかあ、実装するオプションの指定次第です。

パラメータ 必須 説明
baseurl はい Cloudfront が提供する SCHEME://ホスト[/パス]
privatekey はい AWS の Cloudfront が提供する秘密鍵
keypairid はい AWS が提供するキーペア ID
duration いいえ 署名した URL が無効になるまでの期間

reporting

reporting:
  bugsnag:
    apikey: bugsnagapikey
    releasestage: bugsnagreleasestage
    endpoint: bugsnagendpoint
  newrelic:
    licensekey: newreliclicensekey
    name: newrelicname
    verbose: true

reporting オプションは オプション であり、エラーやメトリクスを報告するツールを設定します。現時点でサポートされているのは New RelicBugsnag です。それぞれに必要なオプション項目があります。

パラメータ 必須 説明
apikey はい Bugsnag が提供する API 鍵
releasestage いいえ レジストリの状態を追跡します。例: productionstagingdevelopment
endpoint いいえ enterprise Bugsnag のエンドポイントを指定
パラメータ 必須 説明
licensekey はい New Relic が提供するライセンス・キー
name いいえ New Relic のアプリケーション名
verbose いいえ デバッグ用の出力を標準出力に表示

http

http:
     addr: localhost:5000
     net: tcp
     prefix: /my/nested/registry/
     host: https://myregistryaddress.org:5000
     secret: asecretforlocaldevelopment
     tls:
       certificate: /path/to/x509/public
       key: /path/to/x509/private
       clientcas:
         - /path/to/ca.pem
         - /path/to/another/ca.pem
     debug:
       addr: localhost:5001
     headers:
       X-Content-Type-Options: [nosniff]

(以下ToDo)

The http option details the configuration for the HTTP server that hosts the registry. Parameter Required Description addr yes The address for which the server should accept connections. The form depends on a network type (see net option): HOST:PORT for tcp and FILE for a unix socket. net no The network which is used to create a listening socket. Known networks are unix and tcp. The default empty value means tcp. prefix no If the server does not run at the root path use this value to specify the prefix. The root path is the section before v2. It should have both preceding and trailing slashes, for example /path/. host no This parameter specifies an externally-reachable address for the registry, as a fully qualified URL. If present, it is used when creating generated URLs. Otherwise, these URLs are derived from client requests. secret yes A random piece of data. This is used to sign state that may be stored with the client to protect against tampering. For production environments you should generate a random piece of data using a cryptographically secure random generator. This configuration parameter may be omitted, in which case the registry will automatically generate a secret at launch.

WARNING: If you are building a cluster of registries behind a load balancer, you MUST ensure the secret is the same for all registries. tls

The tls struct within http is optional. Use this to configure TLS for the server. If you already have a server such as Nginx or Apache running on the same host as the registry, you may prefer to configure TLS termination there and proxy connections to the registry server. Parameter Required Description certificate yes Absolute path to x509 cert file key yes Absolute path to x509 private key file. clientcas no An array of absolute paths to a x509 CA file debug

The debug option is optional . Use it to configure a debug server that can be helpful in diagnosing problems. The debug endpoint can be used for monitoring registry metrics and health, as well as profiling. Sensitive information may be available via the debug endpoint. Please be certain that access to the debug endpoint is locked down in a production environment.

The debug section takes a single, required addr parameter. This parameter specifies the HOST:PORT on which the debug server should accept connections. headers

The headers option is optional . Use it to specify headers that the HTTP server should include in responses. This can be used for security headers such as Strict-Transport-Security.

The headers option should contain an option for each header to include, where the parameter name is the header’s name, and the parameter value a list of the header’s payload values.

Including X-Content-Type-Options: [nosniff] is recommended, so that browsers will not interpret content as HTML if they are directed to load a page from the registry. This header is included in the example configuration files. notifications

notifications:
endpoints:

The notifications option is optional and currently may contain a single option, endpoints. endpoints

Endpoints is a list of named services (URLs) that can accept event notifications. Parameter Required Description name yes A human readable name for the service. disabled no A boolean to enable/disable notifications for a service. url yes The URL to which events should be published. headers yes Static headers to add to each request. Each header's name should be a key underneath headers, and each value is a list of payloads for that header name. Note that values must always be lists. timeout yes An HTTP timeout value. This field takes a positive integer and an optional suffix indicating the unit of time. Possible units are:

ns (nanoseconds) us (microseconds) ms (milliseconds) s (seconds) m (minutes) h (hours)

If you omit the suffix, the system interprets the value as nanoseconds. threshold yes An integer specifying how long to wait before backing off a failure. backoff yes How long the system backs off before retrying. This field takes a positive integer and an optional suffix indicating the unit of time. Possible units are:

ns (nanoseconds) us (microseconds) ms (milliseconds) s (seconds) m (minutes) h (hours)

If you omit the suffix, the system interprets the value as nanoseconds. redis

redis:

addr: localhost:6379 password: asecret db: 0 dialtimeout: 10ms readtimeout: 10ms writetimeout: 10ms pool:

maxidle: 16 maxactive: 64 idletimeout: 300s

Declare parameters for constructing the redis connections. Registry instances may use the Redis instance for several applications. The current purpose is caching information about immutable blobs. Most of the options below control how the registry connects to redis. You can control the pool’s behavior with the pool subsection.

It’s advisable to configure Redis itself with the allkeys-lru eviction policy as the registry does not set an expire value on keys. Parameter Required Description addr yes Address (host and port) of redis instance. password no A password used to authenticate to the redis instance. db no Selects the db for each connection. dialtimeout no Timeout for connecting to a redis instance. readtimeout no Timeout for reading from redis connections. writetimeout no Timeout for writing to redis connections. pool

pool:
maxidle: 16 maxactive: 64 idletimeout: 300s

Configure the behavior of the Redis connection pool. Parameter Required Description maxidle no Sets the maximum number of idle connections. maxactive no sets the maximum number of connections that should be opened before blocking a connection request. idletimeout no sets the amount time to wait before closing inactive connections. health

health:
storagedriver:
enabled: true interval: 10s threshold: 3
file:
  • file: /path/to/checked/file interval: 10s
http:
tcp:
  • addr: redis-server.domain.com:6379 timeout: 3s interval: 10s threshold: 3

The health option is optional. It may contain preferences for a periodic health check on the storage driver’s backend storage, and optional periodic checks on local files, HTTP URIs, and/or TCP servers. The results of the health checks are available at /debug/health on the debug HTTP server if the debug HTTP server is enabled (see http section). storagedriver

storagedriver contains options for a health check on the configured storage driver’s backend storage. enabled must be set to true for this health check to be active. Parameter Required Description enabled yes "true" to enable the storage driver health check or "false" to disable it. interval no The length of time to wait between repetitions of the check. This field takes a positive integer and an optional suffix indicating the unit of time. Possible units are:

ns (nanoseconds) us (microseconds) ms (milliseconds) s (seconds) m (minutes) h (hours)

If you omit the suffix, the system interprets the value as nanoseconds. The default value is 10 seconds if this field is omitted. threshold no An integer specifying the number of times the check must fail before the check triggers an unhealthy state. If this filed is not specified, a single failure will trigger an unhealthy state. file

file is a list of paths to be periodically checked for the existence of a file. If a file exists at the given path, the health check will fail. This can be used as a way of bringing a registry out of rotation by creating a file. Parameter Required Description file yes The path to check for the existence of a file. interval no The length of time to wait between repetitions of the check. This field takes a positive integer and an optional suffix indicating the unit of time. Possible units are:

ns (nanoseconds) us (microseconds) ms (milliseconds) s (seconds) m (minutes) h (hours)

If you omit the suffix, the system interprets the value as nanoseconds. The default value is 10 seconds if this field is omitted. http

http is a list of HTTP URIs to be periodically checked with HEAD requests. If a HEAD request doesn’t complete or returns an unexpected status code, the health check will fail. Parameter Required Description uri yes The URI to check. headers no Static headers to add to each request. Each header's name should be a key underneath headers, and each value is a list of payloads for that header name. Note that values must always be lists. statuscode no Expected status code from the HTTP URI. Defaults to 200. timeout no The length of time to wait before timing out the HTTP request. This field takes a positive integer and an optional suffix indicating the unit of time. Possible units are:

ns (nanoseconds) us (microseconds) ms (milliseconds) s (seconds) m (minutes) h (hours)

If you omit the suffix, the system interprets the value as nanoseconds. interval no The length of time to wait between repetitions of the check. This field takes a positive integer and an optional suffix indicating the unit of time. Possible units are:

ns (nanoseconds) us (microseconds) ms (milliseconds) s (seconds) m (minutes) h (hours)

If you omit the suffix, the system interprets the value as nanoseconds. The default value is 10 seconds if this field is omitted. threshold no An integer specifying the number of times the check must fail before the check triggers an unhealthy state. If this filed is not specified, a single failure will trigger an unhealthy state. tcp

tcp is a list of TCP addresses to be periodically checked with connection attempts. The addresses must include port numbers. If a connection attempt fails, the health check will fail. Parameter Required Description addr yes The TCP address to connect to, including a port number. timeout no The length of time to wait before timing out the TCP connection. This field takes a positive integer and an optional suffix indicating the unit of time. Possible units are:

ns (nanoseconds) us (microseconds) ms (milliseconds) s (seconds) m (minutes) h (hours)

If you omit the suffix, the system interprets the value as nanoseconds. interval no The length of time to wait between repetitions of the check. This field takes a positive integer and an optional suffix indicating the unit of time. Possible units are:

ns (nanoseconds) us (microseconds) ms (milliseconds) s (seconds) m (minutes) h (hours)

If you omit the suffix, the system interprets the value as nanoseconds. The default value is 10 seconds if this field is omitted. threshold no An integer specifying the number of times the check must fail before the check triggers an unhealthy state. If this filed is not specified, a single failure will trigger an unhealthy state. Proxy

proxy:
remoteurl: https://registry-1.docker.io username: [username] password: [password]

Proxy enables a registry to be configured as a pull through cache to the official Docker Hub. See mirror for more information. Pushing to a registry configured as a pull through cache is currently unsupported. Parameter Required Description remoteurl yes The URL of the official Docker Hub username no The username of the Docker Hub account password no The password for the official Docker Hub account

To enable pulling private repositories (e.g. batman/robin) a username and password for user batman must be specified. Note: These private repositories will be stored in the proxy cache’s storage and relevant measures should be taken to protect access to this. Compatibility

compatibility:
schema1:
signingkeyfile: /etc/registry/key.json disablesignaturestore: true

Configure handling of older and deprecated features. Each subsection defines a such a feature with configurable behavior. Schema1 Parameter Required Description signingkeyfile no The signing private key used for adding signatures to schema1 manifests. If no signing key is provided, a new ECDSA key will be generated on startup. disablesignaturestore no Disables storage of signatures attached to schema1 manifests. By default signatures are detached from schema1 manifests, stored, and reattached when the manifest is requested. When this is true, the storage is disabled and a new signature is always generated for schema1 manifests using the schema1 signing key. Disabling signature storage will cause all newly uploaded signatures to be discarded. Existing stored signatures will not be removed but they will not be re-attached to the corresponding manifest. Example: Development configuration

The following is a simple example you can use for local development:

version: 0.1 log:

level: debug
storage:
filesystem:
rootdirectory: /var/lib/registry
http:

addr: localhost:5000 secret: asecretforlocaldevelopment debug:

addr: localhost:5001

The above configures the registry instance to run on port 5000, binding to localhost, with the debug server enabled. Registry data storage is in the /var/lib/registry directory. Logging is in debug mode, which is the most verbose.

A similar simple configuration is available at config-example.yml. Both are generally useful for local development. Example: Middleware configuration

This example illustrates how to configure storage middleware in a registry. Middleware allows the registry to serve layers via a content delivery network (CDN). This is useful for reducing requests to the storage layer.

Currently, the registry supports Amazon Cloudfront. You can only use Cloudfront in conjunction with the S3 storage driver. Parameter Description name The storage middleware name. Currently cloudfront is an accepted value. disabled Set to false to easily disable the middleware. options: A set of key/value options to configure the middleware.

baseurl: The Cloudfront base URL. privatekey: The location of your AWS private key on the filesystem. keypairid: The ID of your Cloudfront keypair. duration: The duration in minutes for which the URL is valid. Default is 20.

The following example illustrates these values:

middleware:
storage:

Note: Cloudfront keys exist separately to other AWS keys. See the documentation on AWS credentials for more information.