github.com/mika/distribution@v2.2.2-0.20160108133430-a75790e3d8e0+incompatible/docs/configuration.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Configuring a registry"
     4  description = "Explains how to configure a registry"
     5  keywords = ["registry, on-prem, images, tags, repository, distribution, configuration"]
     6  [menu.main]
     7  parent="smn_registry"
     8  weight=4
     9  +++
    10  <![end-metadata]-->
    11  
    12  # Registry Configuration Reference
    13  
    14  The Registry configuration is based on a YAML file, detailed below. While it comes with sane default values out of the box, you are heavily encouraged to review it exhaustively before moving your systems to production.
    15  
    16  ## Override specific configuration options
    17  
    18  In a typical setup where you run your Registry from the official image, you can specify a configuration variable from the environment by passing `-e` arguments to your `docker run` stanza, or from within a Dockerfile using the `ENV` instruction.
    19  
    20  To override a configuration option, create an environment variable named
    21  `REGISTRY_variable` where *`variable`* is the name of the configuration option
    22  and the `_` (underscore) represents indention levels. For example, you can
    23  configure the `rootdirectory` of the `filesystem` storage backend:
    24  
    25      storage:
    26        filesystem:
    27          rootdirectory: /var/lib/registry
    28  
    29  To override this value, set an environment variable like this:
    30  
    31      REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/somewhere
    32  
    33  This variable overrides the `/var/lib/registry` value to the `/somewhere`
    34  directory.
    35  
    36  >**NOTE**: It is highly recommended to create a base configuration file with which environment variables can be used to tweak individual values.  Overriding configuration sections with environment variables is not recommended.
    37  
    38  ## Overriding the entire configuration file
    39  
    40  If the default configuration is not a sound basis for your usage, or if you are having issues overriding keys from the environment, you can specify an alternate YAML configuration file by mounting it as a volume in the container.
    41  
    42  Typically, create a new configuration file from scratch, and call it `config.yml`, then:
    43  
    44      docker run -d -p 5000:5000 --restart=always --name registry \
    45        -v `pwd`/config.yml:/etc/docker/registry/config.yml \
    46        registry:2
    47  
    48  You can (and probably should) use [this as a starting point](https://github.com/docker/distribution/blob/master/cmd/registry/config-example.yml).
    49  
    50  ## List of configuration options
    51  
    52  This section lists all the registry configuration options. Some options in
    53  the list are mutually exclusive. So, make sure to read the detailed reference
    54  information about each option that appears later in this page.
    55  
    56      version: 0.1
    57      log:
    58        level: debug
    59        formatter: text
    60        fields:
    61          service: registry
    62          environment: staging
    63        hooks:
    64          - type: mail
    65            disabled: true
    66            levels:
    67              - panic
    68            options:
    69              smtp:
    70                addr: mail.example.com:25
    71                username: mailuser
    72                password: password
    73                insecure: true
    74              from: sender@example.com
    75              to:
    76                - errors@example.com
    77      loglevel: debug # deprecated: use "log"
    78      storage:
    79        filesystem:
    80          rootdirectory: /var/lib/registry
    81        azure:
    82          accountname: accountname
    83          accountkey: base64encodedaccountkey
    84          container: containername
    85        gcs:
    86          bucket: bucketname
    87          keyfile: /path/to/keyfile
    88          rootdirectory: /gcs/object/name/prefix
    89        s3:
    90          accesskey: awsaccesskey
    91          secretkey: awssecretkey
    92          region: us-west-1
    93          bucket: bucketname
    94          encrypt: true
    95          secure: true
    96          v4auth: true
    97          chunksize: 5242880
    98          rootdirectory: /s3/object/name/prefix
    99        rados:
   100          poolname: radospool
   101          username: radosuser
   102          chunksize: 4194304
   103        swift:
   104          username: username
   105          password: password
   106          authurl: https://storage.myprovider.com/auth/v1.0 or https://storage.myprovider.com/v2.0 or https://storage.myprovider.com/v3/auth
   107          tenant: tenantname
   108          tenantid: tenantid
   109          domain: domain name for Openstack Identity v3 API
   110          domainid: domain id for Openstack Identity v3 API
   111          insecureskipverify: true
   112          region: fr
   113          container: containername
   114          rootdirectory: /swift/object/name/prefix
   115        delete:
   116          enabled: false
   117        redirect:
   118          disable: false
   119        cache:
   120          blobdescriptor: redis
   121        maintenance:
   122          uploadpurging:
   123            enabled: true
   124            age: 168h
   125            interval: 24h
   126            dryrun: false
   127          readonly:
   128            enabled: false
   129      auth:
   130        silly:
   131          realm: silly-realm
   132          service: silly-service
   133        token:
   134          realm: token-realm
   135          service: token-service
   136          issuer: registry-token-issuer
   137          rootcertbundle: /root/certs/bundle
   138        htpasswd:
   139          realm: basic-realm
   140          path: /path/to/htpasswd
   141      middleware:
   142        registry:
   143          - name: ARegistryMiddleware
   144            options:
   145              foo: bar
   146        repository:
   147          - name: ARepositoryMiddleware
   148            options:
   149              foo: bar
   150        storage:
   151          - name: cloudfront
   152            options:
   153              baseurl: https://my.cloudfronted.domain.com/
   154              privatekey: /path/to/pem
   155              keypairid: cloudfrontkeypairid
   156              duration: 3000
   157      reporting:
   158        bugsnag:
   159          apikey: bugsnagapikey
   160          releasestage: bugsnagreleasestage
   161          endpoint: bugsnagendpoint
   162        newrelic:
   163          licensekey: newreliclicensekey
   164          name: newrelicname
   165          verbose: true
   166      http:
   167        addr: localhost:5000
   168        prefix: /my/nested/registry/
   169        host: https://myregistryaddress.org:5000
   170        secret: asecretforlocaldevelopment
   171        tls:
   172          certificate: /path/to/x509/public
   173          key: /path/to/x509/private
   174          clientcas:
   175            - /path/to/ca.pem
   176            - /path/to/another/ca.pem
   177        debug:
   178          addr: localhost:5001
   179        headers:
   180          X-Content-Type-Options: [nosniff]
   181      notifications:
   182        endpoints:
   183          - name: alistener
   184            disabled: false
   185            url: https://my.listener.com/event
   186            headers: <http.Header>
   187            timeout: 500
   188            threshold: 5
   189            backoff: 1000
   190      redis:
   191        addr: localhost:6379
   192        password: asecret
   193        db: 0
   194        dialtimeout: 10ms
   195        readtimeout: 10ms
   196        writetimeout: 10ms
   197        pool:
   198          maxidle: 16
   199          maxactive: 64
   200          idletimeout: 300s
   201      health:
   202        storagedriver:
   203          enabled: true
   204          interval: 10s
   205          threshold: 3
   206        file:
   207          - file: /path/to/checked/file
   208            interval: 10s
   209        http:
   210          - uri: http://server.to.check/must/return/200
   211            headers:
   212              Authorization: [Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==]
   213            statuscode: 200
   214            timeout: 3s
   215            interval: 10s
   216            threshold: 3
   217        tcp:
   218          - addr: redis-server.domain.com:6379
   219            timeout: 3s
   220            interval: 10s
   221            threshold: 3
   222      proxy:
   223        remoteurl: https://registry-1.docker.io
   224        username: [username]
   225        password: [password]
   226  
   227  In some instances a configuration option is **optional** but it contains child
   228  options marked as **required**. This indicates that you can omit the parent with
   229  all its children. However, if the parent is included, you must also include all
   230  the children marked **required**.
   231  
   232  ## version
   233  
   234      version: 0.1
   235  
   236  The `version` option is **required**. It specifies the configuration's version.
   237  It is expected to remain a top-level field, to allow for a consistent version
   238  check before parsing the remainder of the configuration file.
   239  
   240  ## log
   241  
   242  The `log` subsection configures the behavior of the logging system. The logging
   243  system outputs everything to stdout. You can adjust the granularity and format
   244  with this configuration section.
   245  
   246      log:
   247        level: debug
   248        formatter: text
   249        fields:
   250          service: registry
   251          environment: staging
   252  
   253  <table>
   254    <tr>
   255      <th>Parameter</th>
   256      <th>Required</th>
   257      <th>Description</th>
   258    </tr>
   259    <tr>
   260      <td>
   261        <code>level</code>
   262      </td>
   263      <td>
   264        no
   265      </td>
   266      <td>
   267        Sets the sensitivity of logging output. Permitted values are
   268        <code>error</code>, <code>warn</code>, <code>info</code> and
   269        <code>debug</code>. The default is <code>info</code>.
   270      </td>
   271    </tr>
   272    <tr>
   273      <td>
   274        <code>formatter</code>
   275      </td>
   276      <td>
   277        no
   278      </td>
   279      <td>
   280        This selects the format of logging output. The format primarily affects how keyed
   281        attributes for a log line are encoded. Options are <code>text</code>, <code>json</code> or
   282        <code>logstash</code>. The default is <code>text</code>.
   283      </td>
   284    </tr>
   285      <tr>
   286      <td>
   287        <code>fields</code>
   288      </td>
   289      <td>
   290        no
   291      </td>
   292      <td>
   293        A map of field names to values. These are added to every log line for
   294        the context. This is useful for identifying log messages source after
   295        being mixed in other systems.
   296      </td>
   297  </table>
   298  
   299  ## hooks
   300  
   301      hooks:
   302        - type: mail
   303          levels:
   304            - panic
   305          options:
   306            smtp:
   307              addr: smtp.sendhost.com:25
   308              username: sendername
   309              password: password
   310              insecure: true
   311            from: name@sendhost.com
   312            to:
   313              - name@receivehost.com
   314  
   315  The `hooks` subsection configures the logging hooks' behavior. This subsection
   316  includes a sequence handler which you can use for sending mail, for example.
   317  Refer to `loglevel` to configure the level of messages printed.
   318  
   319  ## loglevel
   320  
   321  > **DEPRECATED:** Please use [log](#log) instead.
   322  
   323      loglevel: debug
   324  
   325  Permitted values are `error`, `warn`, `info` and `debug`. The default is
   326  `info`.
   327  
   328  ## storage
   329  
   330      storage:
   331        filesystem:
   332          rootdirectory: /var/lib/registry
   333        azure:
   334          accountname: accountname
   335          accountkey: base64encodedaccountkey
   336          container: containername
   337        gcs:
   338          bucket: bucketname
   339          keyfile: /path/to/keyfile
   340          rootdirectory: /gcs/object/name/prefix
   341        s3:
   342          accesskey: awsaccesskey
   343          secretkey: awssecretkey
   344          region: us-west-1
   345          bucket: bucketname
   346          encrypt: true
   347          secure: true
   348          v4auth: true
   349          chunksize: 5242880
   350          rootdirectory: /s3/object/name/prefix
   351        rados:
   352          poolname: radospool
   353          username: radosuser
   354          chunksize: 4194304
   355        swift:
   356          username: username
   357          password: password
   358          authurl: https://storage.myprovider.com/v2.0 or https://storage.myprovider.com/v3/auth
   359          tenant: tenantname
   360          tenantid: tenantid
   361          domain: domain name for Openstack Identity v3 API
   362          domainid: domain id for Openstack Identity v3 API
   363          insecureskipverify: true
   364          region: fr
   365          container: containername
   366          rootdirectory: /swift/object/name/prefix
   367        delete:
   368          enabled: false
   369        cache:
   370          blobdescriptor: inmemory
   371        maintenance:
   372          uploadpurging:
   373            enabled: true
   374            age: 168h
   375            interval: 24h
   376            dryrun: false
   377        redirect:
   378          disable: false
   379  
   380  The storage option is **required** and defines which storage backend is in use.
   381  You must configure one backend; if you configure more, the registry returns an error.
   382  
   383  If you are deploying a registry on Windows, be aware that a Windows volume mounted from the host is not recommended. Instead, you can use a S3, or Azure, backing data-store. If you do use a Windows volume, you must ensure that the `PATH` to the mount point is within Windows' `MAX_PATH` limits (typically 255 characters). Failure to do so can result in the following error message:
   384  
   385      mkdir /XXX protocol error and your registry will not function properly.
   386  
   387  ### Maintenance
   388  
   389  Currently upload purging and read-only mode are the only maintenance functions available.
   390  These and future maintenance functions which are related to storage can be configured under
   391  the maintenance section.
   392  
   393  ### Upload Purging
   394  
   395  Upload purging is a background process that periodically removes orphaned files from the upload
   396  directories of the registry.  Upload purging is enabled by default.  To
   397  configure upload directory purging, the following parameters
   398  must be set.
   399  
   400  
   401  | Parameter | Required | Description
   402    --------- | -------- | -----------
   403  `enabled` | yes | Set to true to enable upload purging.  Default=true. |
   404  `age` | yes | Upload directories which are older than this age will be deleted.  Default=168h (1 week)
   405  `interval` | yes | The interval between upload directory purging.  Default=24h.
   406  `dryrun` | yes |  dryrun can be set to true to obtain a summary of what directories will be deleted.  Default=false.
   407  
   408  Note: `age` and `interval` are strings containing a number with optional fraction and a unit suffix: e.g. 45m, 2h10m, 168h (1 week).
   409  
   410  ### Read-only mode
   411  
   412  If the `readonly` section under `maintenance` has `enabled` set to `true`,
   413  clients will not be allowed to write to the registry. This mode is useful to
   414  temporarily prevent writes to the backend storage so a garbage collection pass
   415  can be run.  Before running garbage collection, the registry should be
   416  restarted with readonly's `enabled` set to true. After the garbage collection
   417  pass finishes, the registry may be restarted again, this time with `readonly`
   418  removed from the configuration (or set to false).
   419  
   420  ### delete
   421  
   422  Use the `delete` subsection to enable the deletion of image blobs and manifests
   423  by digest. It defaults to false, but it can be enabled by writing the following
   424  on the configuration file:
   425  
   426      delete:
   427        enabled: true
   428  
   429  ### cache
   430  
   431  Use the `cache` subsection to enable caching of data accessed in the storage
   432  backend. Currently, the only available cache provides fast access to layer
   433  metadata. This, if configured, uses the `blobdescriptor` field.
   434  
   435  You can set `blobdescriptor` field to `redis` or `inmemory`.  The `redis` value uses
   436  a Redis pool to cache layer metadata.  The `inmemory` value uses an in memory
   437  map.
   438  
   439  >**NOTE**: Formerly, `blobdescriptor` was known as `layerinfo`. While these
   440  >are equivalent, `layerinfo` has been deprecated, in favor or
   441  >`blobdescriptor`.
   442  
   443  ### redirect
   444  
   445  The `redirect` subsection provides configuration for managing redirects from
   446  content backends. For backends that support it, redirecting is enabled by
   447  default. Certain deployment scenarios may prefer to route all data through the
   448  Registry, rather than redirecting to the backend. This may be more efficient
   449  when using a backend that is not colocated or when a registry instance is
   450  doing aggressive caching.
   451  
   452  Redirects can be disabled by adding a single flag `disable`, set to `true`
   453  under the `redirect` section:
   454  
   455      redirect:
   456        disable: true
   457  
   458  ### filesystem
   459  
   460  The `filesystem` storage backend uses the local disk to store registry files. It
   461  is ideal for development and may be appropriate for some small-scale production
   462  applications.
   463  
   464  This backend has a single, required `rootdirectory` parameter. The parameter
   465  specifies the absolute path to a directory. The registry stores all its data
   466  here so make sure there is adequate space available.
   467  
   468  ### azure
   469  
   470  This storage backend uses Microsoft's Azure Blob Storage.
   471  
   472  <table>
   473    <tr>
   474      <th>Parameter</th>
   475      <th>Required</th>
   476      <th>Description</th>
   477    </tr>
   478    <tr>
   479      <td>
   480        <code>accountname</code>
   481      </td>
   482      <td>
   483        yes
   484      </td>
   485      <td>
   486        Azure account name.
   487      </td>
   488    </tr>
   489    <tr>
   490      <td>
   491        <code>accountkey</code>
   492      </td>
   493      <td>
   494        yes
   495      </td>
   496      <td>
   497        Azure account key.
   498      </td>
   499    </tr>
   500    <tr>
   501      <td>
   502        <code>container</code>
   503      </td>
   504      <td>
   505        yes
   506      </td>
   507      <td>
   508        Name of the Azure container into which to store data.
   509      </td>
   510    </tr>
   511     <tr>
   512      <td>
   513        <code>realm</code>
   514      </td>
   515      <td>
   516        no
   517      </td>
   518      <td>
   519        Domain name suffix for the Storage Service API endpoint. By default, this
   520        is <code>core.windows.net</code>.
   521      </td>
   522    </tr>
   523  
   524  </table>
   525  
   526  ### gcs
   527  
   528  This storage backend uses Google Cloud Storage.
   529  
   530  <table>
   531    <tr>
   532      <th>Parameter</th>
   533      <th>Required</th>
   534      <th>Description</th>
   535    </tr>
   536    <tr>
   537      <td>
   538        <code>bucket</code>
   539      </td>
   540      <td>
   541        yes
   542      </td>
   543      <td>
   544        Storage bucket name.
   545      </td>
   546    </tr>
   547    <tr>
   548      <td>
   549        <code>keyfile</code>
   550      </td>
   551      <td>
   552        no
   553      </td>
   554      <td>
   555        A private service account key file in JSON format. Instead of a key file <a href="https://developers.google.com/identity/protocols/application-default-credentials">Google Application Default Credentials</a> can be used.
   556      </td>
   557    </tr>
   558     <tr>
   559      <td>
   560        <code>rootdirectory</code>
   561      </td>
   562      <td>
   563        no
   564      </td>
   565      <td>
   566        This is a prefix that will be applied to all Google Cloud Storage keys to allow you to segment data in your bucket if necessary.
   567    </tr>
   568  
   569  </table>
   570  
   571  ### rados
   572  
   573  This storage backend uses [Ceph Object Storage](http://ceph.com/docs/master/rados/).
   574  
   575  <table>
   576    <tr>
   577      <th>Parameter</th>
   578      <th>Required</th>
   579      <th>Description</th>
   580    </tr>
   581    <tr>
   582      <td>
   583        <code>poolname</code>
   584      </td>
   585      <td>
   586        yes
   587      </td>
   588      <td>
   589        Ceph pool name.
   590      </td>
   591    </tr>
   592     <tr>
   593      <td>
   594        <code>username</code>
   595      </td>
   596      <td>
   597        no
   598      </td>
   599      <td>
   600        Ceph cluster user to connect as (i.e. admin, not client.admin).
   601      </td>
   602    </tr>
   603     <tr>
   604      <td>
   605        <code>chunksize</code>
   606      </td>
   607      <td>
   608        no
   609      </td>
   610      <td>
   611        Size of the written RADOS objects. Default value is 4MB (4194304).
   612      </td>
   613    </tr>
   614  </table>
   615  
   616  
   617  ### S3
   618  
   619  This storage backend uses Amazon's Simple Storage Service (S3).
   620  
   621  <table>
   622    <tr>
   623      <th>Parameter</th>
   624      <th>Required</th>
   625      <th>Description</th>
   626    </tr>
   627    <tr>
   628      <td>
   629        <code>accesskey</code>
   630      </td>
   631      <td>
   632        yes
   633      </td>
   634      <td>
   635        Your AWS Access Key.
   636      </td>
   637    </tr>
   638      <tr>
   639      <td>
   640        <code>secretkey</code>
   641      </td>
   642      <td>
   643        yes
   644      </td>
   645      <td>
   646        Your AWS Secret Key.
   647      </td>
   648    </tr>
   649      <tr>
   650      <td>
   651        <code>region</code>
   652      </td>
   653      <td>
   654        yes
   655      </td>
   656      <td>
   657        The AWS region in which your bucket exists. For the moment, the Go AWS
   658        library in use does not use the newer DNS based bucket routing.
   659      </td>
   660    </tr>
   661      <tr>
   662      <td>
   663        <code>bucket</code>
   664      </td>
   665      <td>
   666        yes
   667      </td>
   668      <td>
   669        The bucket name in which you want to store the registry's data.
   670      </td>
   671    </tr>
   672      <tr>
   673      <td>
   674        <code>encrypt</code>
   675      </td>
   676      <td>
   677        no
   678      </td>
   679      <td>
   680         Specifies whether the registry stores the image in encrypted format or
   681         not. A boolean value. The default is false.
   682      </td>
   683    </tr>
   684      <tr>
   685      <td>
   686        <code>secure</code>
   687      </td>
   688      <td>
   689        no
   690      </td>
   691      <td>
   692        Indicates whether to use HTTPS instead of HTTP. A boolean value. The
   693        default is <code>true</code>.
   694      </td>
   695    </tr>
   696      <tr>
   697      <td>
   698        <code>v4auth</code>
   699      </td>
   700      <td>
   701        no
   702      </td>
   703      <td>
   704        Indicates whether the registry uses Version 4 of AWS's authentication.
   705        Generally, you should set this to <code>true</code>. By default, this is
   706        <code>false</code>.
   707      </td>
   708    </tr>
   709      <tr>
   710      <td>
   711        <code>chunksize</code>
   712      </td>
   713      <td>
   714        no
   715      </td>
   716      <td>
   717        The S3 API requires multipart upload chunks to be at least 5MB. This value
   718        should be a number that is larger than 5*1024*1024.
   719      </td>
   720    </tr>
   721     <tr>
   722      <td>
   723        <code>rootdirectory</code>
   724      </td>
   725      <td>
   726        no
   727      </td>
   728      <td>
   729        This is a prefix that will be applied to all S3 keys to allow you to segment data in your bucket if necessary.
   730      </td>
   731    </tr>
   732  </table>
   733  
   734  ### Openstack Swift
   735  
   736  This storage backend uses Openstack Swift object storage.
   737  
   738  <table>
   739    <tr>
   740      <th>Parameter</th>
   741      <th>Required</th>
   742      <th>Description</th>
   743    </tr>
   744    <tr>
   745      <td>
   746        <code>authurl</code>
   747      </td>
   748      <td>
   749        yes
   750      </td>
   751      <td>
   752        URL for obtaining an auth token. https://storage.myprovider.com/v2.0 or https://storage.myprovider.com/v3/auth
   753      </td>
   754    </tr>
   755    <tr>
   756      <td>
   757        <code>username</code>
   758      </td>
   759      <td>
   760        yes
   761      </td>
   762      <td>
   763        Your Openstack user name.
   764      </td>
   765    </tr>
   766    <tr>
   767      <td>
   768        <code>password</code>
   769      </td>
   770      <td>
   771        yes
   772      </td>
   773      <td>
   774        Your Openstack password.
   775      </td>
   776    </tr>
   777    <tr>
   778      <td>
   779        <code>region</code>
   780      </td>
   781      <td>
   782        no
   783      </td>
   784      <td>
   785        The Openstack region in which your container exists.
   786      </td>
   787    </tr>
   788    <tr>
   789      <td>
   790        <code>container</code>
   791      </td>
   792      <td>
   793        yes
   794      </td>
   795      <td>
   796        The name of your Swift container where you wish to store the registry's data. The driver creates the named container during its initialization.
   797      </td>
   798    </tr>
   799    <tr>
   800      <td>
   801        <code>tenant</code>
   802      </td>
   803      <td>
   804        no
   805      </td>
   806      <td>
   807        Your Openstack tenant name. You can either use <code>tenant</code> or <code>tenantid</code>.
   808      </td>
   809    </tr>
   810    <tr>
   811      <td>
   812        <code>tenantid</code>
   813      </td>
   814      <td>
   815        no
   816      </td>
   817      <td>
   818        Your Openstack tenant id. You can either use <code>tenant</code> or <code>tenantid</code>.
   819      </td>
   820    </tr>
   821    <tr>
   822      <td>
   823        <code>domain</code>
   824      </td>
   825      <td>
   826        no
   827      </td>
   828      <td>
   829        Your Openstack domain name for Identity v3 API. You can either use <code>domain</code> or <code>domainid</code>.
   830      </td>
   831    </tr>
   832    <tr>
   833      <td>
   834        <code>domainid</code>
   835      </td>
   836      <td>
   837        no
   838      </td>
   839      <td>
   840        Your Openstack domain id for Identity v3 API. You can either use <code>domain</code> or <code>domainid</code>.
   841      </td>
   842    </tr>
   843    <tr>
   844      <td>
   845        <code>trustid</code>
   846      </td>
   847      <td>
   848        no
   849      </td>
   850      <td>
   851        Your Openstack trust id for Identity v3 API.
   852      </td>
   853    </tr>
   854    <tr>
   855      <td>
   856        <code>insecureskipverify</code>
   857      </td>
   858      <td>
   859        no
   860      </td>
   861      <td>
   862        true to skip TLS verification, false by default.
   863      </td>
   864    </tr>
   865    <tr>
   866      <td>
   867        <code>chunksize</code>
   868      </td>
   869      <td>
   870        no
   871      </td>
   872      <td>
   873        Size of the data segments for the Swift Dynamic Large Objects. This value should be a number (defaults to 5M).
   874      </td>
   875    </tr>
   876    <tr>
   877      <td>
   878        <code>prefix</code>
   879      </td>
   880      <td>
   881        no
   882      </td>
   883      <td>
   884        This is a prefix that will be applied to all Swift keys to allow you to segment data in your container if necessary. Defaults to the empty string which is the container's root.
   885      </td>
   886    </tr>
   887    <tr>
   888      <td>
   889        <code>secretkey</code>
   890      </td>
   891      <td>
   892        no
   893      </td>
   894      <td>
   895        The secret key used to generate temporary URLs.
   896      </td>
   897    </tr>
   898    <tr>
   899      <td>
   900        <code>accesskey</code>
   901      </td>
   902      <td>
   903        no
   904      </td>
   905      <td>
   906        The access key to generate temporary URLs. It is used by HP Cloud Object Storage in addition to the `secretkey` parameter.
   907      </td>
   908    </tr>
   909  </table>
   910  
   911  
   912  ## auth
   913  
   914      auth:
   915        silly:
   916          realm: silly-realm
   917          service: silly-service
   918        token:
   919          realm: token-realm
   920          service: token-service
   921          issuer: registry-token-issuer
   922          rootcertbundle: /root/certs/bundle
   923        htpasswd:
   924          realm: basic-realm
   925          path: /path/to/htpasswd
   926  
   927  The `auth` option is **optional**. There are
   928  currently 3 possible auth providers, `silly`, `token` and `htpasswd`. You can configure only
   929  one `auth` provider.
   930  
   931  ### silly
   932  
   933  The `silly` auth is only for development purposes. It simply checks for the
   934  existence of the `Authorization` header in the HTTP request. It has no regard for
   935  the header's value. If the header does not exist, the `silly` auth responds with a
   936  challenge response, echoing back the realm, service, and scope that access was
   937  denied for.
   938  
   939  The following values are used to configure the response:
   940  
   941  <table>
   942    <tr>
   943      <th>Parameter</th>
   944      <th>Required</th>
   945      <th>Description</th>
   946    </tr>
   947    <tr>
   948      <td>
   949        <code>realm</code>
   950      </td>
   951      <td>
   952        yes
   953      </td>
   954      <td>
   955        The realm in which the registry server authenticates.
   956      </td>
   957    </tr>
   958      <tr>
   959      <td>
   960        <code>service</code>
   961      </td>
   962      <td>
   963        yes
   964      </td>
   965      <td>
   966        The service being authenticated.
   967      </td>
   968    </tr>
   969  </table>
   970  
   971  
   972  
   973  ### token
   974  
   975  Token based authentication allows the authentication system to be decoupled from
   976  the registry. It is a well established authentication paradigm with a high
   977  degree of security.
   978  
   979  <table>
   980    <tr>
   981      <th>Parameter</th>
   982      <th>Required</th>
   983      <th>Description</th>
   984    </tr>
   985    <tr>
   986      <td>
   987        <code>realm</code>
   988      </td>
   989      <td>
   990        yes
   991      </td>
   992      <td>
   993        The realm in which the registry server authenticates.
   994      </td>
   995    </tr>
   996      <tr>
   997      <td>
   998        <code>service</code>
   999      </td>
  1000      <td>
  1001        yes
  1002      </td>
  1003      <td>
  1004        The service being authenticated.
  1005      </td>
  1006    </tr>
  1007      <tr>
  1008      <td>
  1009        <code>issuer</code>
  1010      </td>
  1011      <td>
  1012        yes
  1013      </td>
  1014      <td>
  1015  The name of the token issuer. The issuer inserts this into
  1016  the token so it must match the value configured for the issuer.
  1017      </td>
  1018    </tr>
  1019      <tr>
  1020      <td>
  1021        <code>rootcertbundle</code>
  1022      </td>
  1023      <td>
  1024        yes
  1025       </td>
  1026      <td>
  1027  The absolute path to the root certificate bundle. This bundle contains the
  1028  public part of the certificates that is used to sign authentication tokens.
  1029       </td>
  1030    </tr>
  1031  </table>
  1032  
  1033  For more information about Token based authentication configuration, see the [specification](spec/auth/token.md).
  1034  
  1035  ### htpasswd
  1036  
  1037  The _htpasswd_ authentication backed allows one to configure basic auth using an
  1038  [Apache HTPasswd File](https://httpd.apache.org/docs/2.4/programs/htpasswd.html).
  1039  Only [`bcrypt`](http://en.wikipedia.org/wiki/Bcrypt) format passwords are
  1040  supported. Entries with other hash types will be ignored. The htpasswd file is
  1041  loaded once, at startup. If the file is invalid, the registry will display an
  1042  error and will not start.
  1043  
  1044  > __WARNING:__ This authentication scheme should only be used with TLS
  1045  > configured, since basic authentication sends passwords as part of the http
  1046  > header.
  1047  
  1048  <table>
  1049    <tr>
  1050      <th>Parameter</th>
  1051      <th>Required</th>
  1052      <th>Description</th>
  1053    </tr>
  1054    <tr>
  1055      <td>
  1056        <code>realm</code>
  1057      </td>
  1058      <td>
  1059        yes
  1060      </td>
  1061      <td>
  1062        The realm in which the registry server authenticates.
  1063      </td>
  1064    </tr>
  1065      <tr>
  1066      <td>
  1067        <code>path</code>
  1068      </td>
  1069      <td>
  1070        yes
  1071      </td>
  1072      <td>
  1073        Path to htpasswd file to load at startup.
  1074      </td>
  1075    </tr>
  1076  </table>
  1077  
  1078  ## middleware
  1079  
  1080  The `middleware` option is **optional**. Use this option to inject middleware at
  1081  named hook points. All middlewares must implement the same interface as the
  1082  object they're wrapping. This means a registry middleware must implement the
  1083  `distribution.Namespace` interface, repository middleware must implement
  1084  `distribution.Repository`, and storage middleware must implement
  1085  `driver.StorageDriver`.
  1086  
  1087  Currently only one middleware, `cloudfront`, a storage middleware, is supported
  1088  in the registry implementation.
  1089  
  1090      middleware:
  1091        registry:
  1092          - name: ARegistryMiddleware
  1093            options:
  1094              foo: bar
  1095        repository:
  1096          - name: ARepositoryMiddleware
  1097            options:
  1098              foo: bar
  1099        storage:
  1100          - name: cloudfront
  1101            options:
  1102              baseurl: https://my.cloudfronted.domain.com/
  1103              privatekey: /path/to/pem
  1104              keypairid: cloudfrontkeypairid
  1105              duration: 3000
  1106  
  1107  Each middleware entry has `name` and `options` entries. The `name` must
  1108  correspond to the name under which the middleware registers itself. The
  1109  `options` field is a map that details custom configuration required to
  1110  initialize the middleware. It is treated as a `map[string]interface{}`. As such,
  1111  it supports any interesting structures desired, leaving it up to the middleware
  1112  initialization function to best determine how to handle the specific
  1113  interpretation of the options.
  1114  
  1115  ### cloudfront
  1116  
  1117  <table>
  1118    <tr>
  1119      <th>Parameter</th>
  1120      <th>Required</th>
  1121      <th>Description</th>
  1122    </tr>
  1123    <tr>
  1124      <td>
  1125        <code>baseurl</code>
  1126      </td>
  1127      <td>
  1128        yes
  1129      </td>
  1130      <td>
  1131        <code>SCHEME://HOST[/PATH]</code> at which Cloudfront is served.
  1132      </td>
  1133    </tr>
  1134      <tr>
  1135      <td>
  1136        <code>privatekey</code>
  1137      </td>
  1138      <td>
  1139        yes
  1140      </td>
  1141      <td>
  1142        Private Key for Cloudfront provided by AWS.
  1143      </td>
  1144    </tr>
  1145      <tr>
  1146      <td>
  1147        <code>keypairid</code>
  1148      </td>
  1149      <td>
  1150        yes
  1151      </td>
  1152      <td>
  1153        Key pair ID provided by AWS.
  1154      </td>
  1155    </tr>
  1156      <tr>
  1157      <td>
  1158        <code>duration</code>
  1159      </td>
  1160      <td>
  1161        no
  1162      </td>
  1163      <td>
  1164        Duration for which a signed URL should be valid.
  1165      </td>
  1166    </tr>
  1167  </table>
  1168  
  1169  
  1170  ## reporting
  1171  
  1172      reporting:
  1173        bugsnag:
  1174          apikey: bugsnagapikey
  1175          releasestage: bugsnagreleasestage
  1176          endpoint: bugsnagendpoint
  1177        newrelic:
  1178          licensekey: newreliclicensekey
  1179          name: newrelicname
  1180          verbose: true
  1181  
  1182  The `reporting` option is **optional** and configures error and metrics
  1183  reporting tools. At the moment only two services are supported, [New
  1184  Relic](http://newrelic.com/) and [Bugsnag](http://bugsnag.com), a valid
  1185  configuration may contain both.
  1186  
  1187  ### bugsnag
  1188  
  1189  <table>
  1190    <tr>
  1191      <th>Parameter</th>
  1192      <th>Required</th>
  1193      <th>Description</th>
  1194    </tr>
  1195    <tr>
  1196      <td>
  1197        <code>apikey</code>
  1198      </td>
  1199      <td>
  1200        yes
  1201      </td>
  1202      <td>
  1203        API Key provided by Bugsnag
  1204      </td>
  1205    </tr>
  1206    <tr>
  1207      <td>
  1208        <code>releasestage</code>
  1209      </td>
  1210      <td>
  1211        no
  1212      </td>
  1213      <td>
  1214        Tracks where the registry is deployed, for example,
  1215        <code>production</code>,<code>staging</code>, or
  1216        <code>development</code>.
  1217      </td>
  1218    </tr>
  1219    <tr>
  1220      <td>
  1221        <code>endpoint</code>
  1222      </td>
  1223      <td>
  1224        no
  1225      </td>
  1226      <td>
  1227        Specify the enterprise Bugsnag endpoint.
  1228      </td>
  1229    </tr>
  1230  </table>
  1231  
  1232  
  1233  ### newrelic
  1234  
  1235  <table>
  1236    <tr>
  1237      <th>Parameter</th>
  1238      <th>Required</th>
  1239      <th>Description</th>
  1240    </tr>
  1241    <tr>
  1242      <td>
  1243        <code>licensekey</code>
  1244      </td>
  1245      <td>
  1246        yes
  1247      </td>
  1248      <td>
  1249        License key provided by New Relic.
  1250      </td>
  1251    </tr>
  1252     <tr>
  1253      <td>
  1254        <code>name</code>
  1255      </td>
  1256      <td>
  1257        no
  1258      </td>
  1259      <td>
  1260        New Relic application name.
  1261      </td>
  1262    </tr>
  1263       <tr>
  1264      <td>
  1265        <code>verbose</code>
  1266      </td>
  1267      <td>
  1268        no
  1269      </td>
  1270      <td>
  1271        Enable New Relic debugging output on stdout.
  1272      </td>
  1273    </tr>
  1274  </table>
  1275  
  1276  ## http
  1277  
  1278      http:
  1279        addr: localhost:5000
  1280        net: tcp
  1281        prefix: /my/nested/registry/
  1282        host: https://myregistryaddress.org:5000
  1283        secret: asecretforlocaldevelopment
  1284        tls:
  1285          certificate: /path/to/x509/public
  1286          key: /path/to/x509/private
  1287          clientcas:
  1288            - /path/to/ca.pem
  1289            - /path/to/another/ca.pem
  1290        debug:
  1291          addr: localhost:5001
  1292        headers:
  1293          X-Content-Type-Options: [nosniff]
  1294  
  1295  The `http` option details the configuration for the HTTP server that hosts the registry.
  1296  
  1297  <table>
  1298    <tr>
  1299      <th>Parameter</th>
  1300      <th>Required</th>
  1301      <th>Description</th>
  1302    </tr>
  1303    <tr>
  1304      <td>
  1305        <code>addr</code>
  1306      </td>
  1307      <td>
  1308        yes
  1309      </td>
  1310      <td>
  1311       The address for which the server should accept connections. The form depends on a network type (see <code>net</code> option):
  1312       <code>HOST:PORT</code> for tcp and <code>FILE</code> for a unix socket.
  1313      </td>
  1314    </tr>
  1315    <tr>
  1316      <td>
  1317        <code>net</code>
  1318      </td>
  1319      <td>
  1320        no
  1321      </td>
  1322      <td>
  1323       The network which is used to create a listening socket. Known networks are <code>unix</code> and <code>tcp</code>.
  1324       The default empty value means tcp.
  1325      </td>
  1326    </tr>
  1327    <tr>
  1328      <td>
  1329        <code>prefix</code>
  1330      </td>
  1331      <td>
  1332        no
  1333      </td>
  1334      <td>
  1335  If the server does not run at the root path use this value to specify the
  1336  prefix. The root path is the section before <code>v2</code>. It
  1337  should have both preceding and trailing slashes, for example <code>/path/</code>.
  1338      </td>
  1339    </tr>
  1340    <tr>
  1341      <td>
  1342        <code>host</code>
  1343      </td>
  1344      <td>
  1345        no
  1346      </td>
  1347      <td>
  1348  This parameter specifies an externally-reachable address for the registry, as a
  1349  fully qualified URL. If present, it is used when creating generated URLs.
  1350  Otherwise, these URLs are derived from client requests.
  1351      </td>
  1352    </tr>
  1353    <tr>
  1354      <td>
  1355        <code>secret</code>
  1356      </td>
  1357      <td>
  1358        yes
  1359      </td>
  1360      <td>
  1361  A random piece of data. This is used to sign state that may be stored with the
  1362  client to protect against tampering. For production environments you should generate a
  1363  random piece of data using a cryptographically secure random generator. This
  1364  configuration parameter may be omitted, in which case the registry will automatically
  1365  generate a secret at launch.
  1366  <p />
  1367  <b>WARNING: If you are building a cluster of registries behind a load balancer, you MUST
  1368  ensure the secret is the same for all registries.</b>
  1369      </td>
  1370    </tr>
  1371  </table>
  1372  
  1373  
  1374  ### tls
  1375  
  1376  The `tls` struct within `http` is **optional**. Use this to configure TLS
  1377  for the server. If you already have a server such as Nginx or Apache running on
  1378  the same host as the registry, you may prefer to configure TLS termination there
  1379  and proxy connections to the registry server.
  1380  
  1381  <table>
  1382    <tr>
  1383      <th>Parameter</th>
  1384      <th>Required</th>
  1385      <th>Description</th>
  1386    </tr>
  1387    <tr>
  1388      <td>
  1389        <code>certificate</code>
  1390      </td>
  1391      <td>
  1392        yes
  1393      </td>
  1394      <td>
  1395         Absolute path to x509 cert file
  1396      </td>
  1397    </tr>
  1398      <tr>
  1399      <td>
  1400        <code>key</code>
  1401      </td>
  1402      <td>
  1403        yes
  1404      </td>
  1405      <td>
  1406        Absolute path to x509 private key file.
  1407      </td>
  1408    </tr>
  1409    <tr>
  1410      <td>
  1411        <code>clientcas</code>
  1412      </td>
  1413      <td>
  1414        no
  1415      </td>
  1416      <td>
  1417        An array of absolute paths to a x509 CA file
  1418      </td>
  1419    </tr>
  1420  </table>
  1421  
  1422  
  1423  ### debug
  1424  
  1425  The `debug` option is **optional** . Use it to configure a debug server that
  1426  can be helpful in diagnosing problems. The debug endpoint can be used for
  1427  monitoring registry metrics and health, as well as profiling. Sensitive
  1428  information may be available via the debug endpoint. Please be certain that
  1429  access to the debug endpoint is locked down in a production environment.
  1430  
  1431  The `debug` section takes a single, required `addr` parameter. This parameter
  1432  specifies the `HOST:PORT` on which the debug server should accept connections.
  1433  
  1434  
  1435  ### headers
  1436  
  1437  The `headers` option is **optional** . Use it to specify headers that the HTTP
  1438  server should include in responses. This can be used for security headers such
  1439  as `Strict-Transport-Security`.
  1440  
  1441  The `headers` option should contain an option for each header to include, where
  1442  the parameter name is the header's name, and the parameter value a list of the
  1443  header's payload values.
  1444  
  1445  Including `X-Content-Type-Options: [nosniff]` is recommended, so that browsers
  1446  will not interpret content as HTML if they are directed to load a page from the
  1447  registry. This header is included in the example configuration files.
  1448  
  1449  
  1450  ## notifications
  1451  
  1452      notifications:
  1453        endpoints:
  1454          - name: alistener
  1455            disabled: false
  1456            url: https://my.listener.com/event
  1457            headers: <http.Header>
  1458            timeout: 500
  1459            threshold: 5
  1460            backoff: 1000
  1461  
  1462  The notifications option is **optional** and currently may contain a single
  1463  option, `endpoints`.
  1464  
  1465  ### endpoints
  1466  
  1467  Endpoints is a list of named services (URLs) that can accept event notifications.
  1468  
  1469  <table>
  1470    <tr>
  1471      <th>Parameter</th>
  1472      <th>Required</th>
  1473      <th>Description</th>
  1474    </tr>
  1475    <tr>
  1476      <td>
  1477        <code>name</code>
  1478      </td>
  1479      <td>
  1480        yes
  1481      </td>
  1482      <td>
  1483  A human readable name for the service.
  1484  </td>
  1485    </tr>
  1486    <tr>
  1487      <td>
  1488        <code>disabled</code>
  1489      </td>
  1490      <td>
  1491        no
  1492      </td>
  1493      <td>
  1494  A boolean to enable/disable notifications for a service.
  1495      </td>
  1496    </tr>
  1497    <tr>
  1498      <td>
  1499        <code>url</code>
  1500      </td>
  1501      <td>
  1502      yes
  1503      </td>
  1504      <td>
  1505  The URL to which events should be published.
  1506      </td>
  1507    </tr>
  1508     <tr>
  1509      <td>
  1510        <code>headers</code>
  1511      </td>
  1512      <td>
  1513        yes
  1514      </td>
  1515      <td>
  1516        Static headers to add to each request. Each header's name should be a key
  1517        underneath headers, and each value is a list of payloads for that
  1518        header name. Note that values must always be lists.
  1519      </td>
  1520    </tr>
  1521    <tr>
  1522      <td>
  1523        <code>timeout</code>
  1524      </td>
  1525      <td>
  1526        yes
  1527      </td>
  1528      <td>
  1529        An HTTP timeout value. This field takes a positive integer and an optional
  1530        suffix indicating the unit of time. Possible units are:
  1531        <ul>
  1532          <li><code>ns</code> (nanoseconds)</li>
  1533          <li><code>us</code> (microseconds)</li>
  1534          <li><code>ms</code> (milliseconds)</li>
  1535          <li><code>s</code> (seconds)</li>
  1536          <li><code>m</code> (minutes)</li>
  1537          <li><code>h</code> (hours)</li>
  1538        </ul>
  1539      If you omit the suffix, the system interprets the value as nanoseconds.
  1540      </td>
  1541    </tr>
  1542    <tr>
  1543      <td>
  1544        <code>threshold</code>
  1545      </td>
  1546      <td>
  1547        yes
  1548      </td>
  1549      <td>
  1550        An integer specifying how long to wait before backing off a failure.
  1551      </td>
  1552    </tr>
  1553    <tr>
  1554      <td>
  1555        <code>backoff</code>
  1556      </td>
  1557      <td>
  1558        yes
  1559      </td>
  1560      <td>
  1561        How long the system backs off before retrying. This field takes a positive
  1562        integer and an optional suffix indicating the unit of time. Possible units
  1563        are:
  1564        <ul>
  1565          <li><code>ns</code> (nanoseconds)</li>
  1566          <li><code>us</code> (microseconds)</li>
  1567          <li><code>ms</code> (milliseconds)</li>
  1568          <li><code>s</code> (seconds)</li>
  1569          <li><code>m</code> (minutes)</li>
  1570          <li><code>h</code> (hours)</li>
  1571        </ul>
  1572      If you omit the suffix, the system interprets the value as nanoseconds.
  1573      </td>
  1574    </tr>
  1575  </table>
  1576  
  1577  
  1578  ## redis
  1579  
  1580      redis:
  1581        addr: localhost:6379
  1582        password: asecret
  1583        db: 0
  1584        dialtimeout: 10ms
  1585        readtimeout: 10ms
  1586        writetimeout: 10ms
  1587        pool:
  1588          maxidle: 16
  1589          maxactive: 64
  1590          idletimeout: 300s
  1591  
  1592  Declare parameters for constructing the redis connections. Registry instances
  1593  may use the Redis instance for several applications. The current purpose is
  1594  caching information about immutable blobs. Most of the options below control
  1595  how the registry connects to redis. You can control the pool's behavior
  1596  with the [pool](#pool) subsection.
  1597  
  1598  It's advisable to configure Redis itself with the **allkeys-lru** eviction policy
  1599  as the registry does not set an expire value on keys.
  1600  
  1601  <table>
  1602    <tr>
  1603      <th>Parameter</th>
  1604      <th>Required</th>
  1605      <th>Description</th>
  1606    </tr>
  1607    <tr>
  1608      <td>
  1609        <code>addr</code>
  1610      </td>
  1611      <td>
  1612        yes
  1613      </td>
  1614      <td>
  1615        Address (host and port) of redis instance.
  1616      </td>
  1617    </tr>
  1618    <tr>
  1619      <td>
  1620        <code>password</code>
  1621      </td>
  1622      <td>
  1623        no
  1624      </td>
  1625      <td>
  1626        A password used to authenticate to the redis instance.
  1627      </td>
  1628    </tr>
  1629    <tr>
  1630      <td>
  1631        <code>db</code>
  1632      </td>
  1633      <td>
  1634        no
  1635      </td>
  1636      <td>
  1637        Selects the db for each connection.
  1638      </td>
  1639    </tr>
  1640    <tr>
  1641      <td>
  1642        <code>dialtimeout</code>
  1643      </td>
  1644      <td>
  1645        no
  1646      </td>
  1647      <td>
  1648        Timeout for connecting to a redis instance.
  1649      </td>
  1650    </tr>
  1651    <tr>
  1652      <td>
  1653        <code>readtimeout</code>
  1654      </td>
  1655      <td>
  1656        no
  1657      </td>
  1658      <td>
  1659        Timeout for reading from redis connections.
  1660      </td>
  1661    </tr>
  1662    <tr>
  1663      <td>
  1664        <code>writetimeout</code>
  1665      </td>
  1666      <td>
  1667        no
  1668      </td>
  1669      <td>
  1670        Timeout for writing to redis connections.
  1671      </td>
  1672    </tr>
  1673  </table>
  1674  
  1675  
  1676  ### pool
  1677  
  1678      pool:
  1679        maxidle: 16
  1680        maxactive: 64
  1681        idletimeout: 300s
  1682  
  1683  Configure the behavior of the Redis connection pool.
  1684  
  1685  <table>
  1686    <tr>
  1687      <th>Parameter</th>
  1688      <th>Required</th>
  1689      <th>Description</th>
  1690    </tr>
  1691    <tr>
  1692      <td>
  1693        <code>maxidle</code>
  1694      </td>
  1695      <td>
  1696        no
  1697      </td>
  1698      <td>
  1699        Sets the maximum number of idle connections.
  1700      </td>
  1701    </tr>
  1702    <tr>
  1703      <td>
  1704        <code>maxactive</code>
  1705      </td>
  1706      <td>
  1707        no
  1708      </td>
  1709      <td>
  1710        sets the maximum number of connections that should
  1711    be opened before blocking a connection request.
  1712      </td>
  1713    </tr>
  1714    <tr>
  1715      <td>
  1716        <code>idletimeout</code>
  1717      </td>
  1718      <td>
  1719        no
  1720      </td>
  1721      <td>
  1722        sets the amount time to wait before closing
  1723    inactive connections.
  1724      </td>
  1725    </tr>
  1726  </table>
  1727  
  1728  ## health
  1729  
  1730      health:
  1731        storagedriver:
  1732          enabled: true
  1733          interval: 10s
  1734          threshold: 3
  1735        file:
  1736          - file: /path/to/checked/file
  1737            interval: 10s
  1738        http:
  1739          - uri: http://server.to.check/must/return/200
  1740            headers:
  1741              Authorization: [Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==]
  1742            statuscode: 200
  1743            timeout: 3s
  1744            interval: 10s
  1745            threshold: 3
  1746        tcp:
  1747          - addr: redis-server.domain.com:6379
  1748            timeout: 3s
  1749            interval: 10s
  1750            threshold: 3
  1751  
  1752  The health option is **optional**. It may contain preferences for a periodic
  1753  health check on the storage driver's backend storage, and optional periodic
  1754  checks on local files, HTTP URIs, and/or TCP servers. The results of the health
  1755  checks are available at /debug/health on the debug HTTP server if the debug
  1756  HTTP server is enabled (see http section).
  1757  
  1758  ### storagedriver
  1759  
  1760  storagedriver contains options for a health check on the configured storage
  1761  driver's backend storage. enabled must be set to true for this health check to
  1762  be active.
  1763  
  1764  <table>
  1765    <tr>
  1766      <th>Parameter</th>
  1767      <th>Required</th>
  1768      <th>Description</th>
  1769    </tr>
  1770    <tr>
  1771      <td>
  1772        <code>enabled</code>
  1773      </td>
  1774      <td>
  1775        yes
  1776      </td>
  1777      <td>
  1778  "true" to enable the storage driver health check or "false" to disable it.
  1779  </td>
  1780    </tr>
  1781    <tr>
  1782      <td>
  1783        <code>interval</code>
  1784      </td>
  1785      <td>
  1786        no
  1787      </td>
  1788      <td>
  1789        The length of time to wait between repetitions of the check. This field
  1790        takes a positive integer and an optional suffix indicating the unit of
  1791        time. Possible units are:
  1792        <ul>
  1793          <li><code>ns</code> (nanoseconds)</li>
  1794          <li><code>us</code> (microseconds)</li>
  1795          <li><code>ms</code> (milliseconds)</li>
  1796          <li><code>s</code> (seconds)</li>
  1797          <li><code>m</code> (minutes)</li>
  1798          <li><code>h</code> (hours)</li>
  1799        </ul>
  1800      If you omit the suffix, the system interprets the value as nanoseconds.
  1801      The default value is 10 seconds if this field is omitted.
  1802      </td>
  1803    </tr>
  1804    <tr>
  1805      <td>
  1806        <code>threshold</code>
  1807      </td>
  1808      <td>
  1809        no
  1810      </td>
  1811      <td>
  1812        An integer specifying the number of times the check must fail before the
  1813        check triggers an unhealthy state. If this filed is not specified, a
  1814        single failure will trigger an unhealthy state.
  1815      </td>
  1816    </tr>
  1817  </table>
  1818  
  1819  ### file
  1820  
  1821  file is a list of paths to be periodically checked for the existence of a file.
  1822  If a file exists at the given path, the health check will fail. This can be
  1823  used as a way of bringing a registry out of rotation by creating a file.
  1824  
  1825  <table>
  1826    <tr>
  1827      <th>Parameter</th>
  1828      <th>Required</th>
  1829      <th>Description</th>
  1830    </tr>
  1831    <tr>
  1832      <td>
  1833        <code>file</code>
  1834      </td>
  1835      <td>
  1836        yes
  1837      </td>
  1838      <td>
  1839  The path to check for the existence of a file.
  1840  </td>
  1841    </tr>
  1842    <tr>
  1843      <td>
  1844        <code>interval</code>
  1845      </td>
  1846      <td>
  1847        no
  1848      </td>
  1849      <td>
  1850        The length of time to wait between repetitions of the check. This field
  1851        takes a positive integer and an optional suffix indicating the unit of
  1852        time. Possible units are:
  1853        <ul>
  1854          <li><code>ns</code> (nanoseconds)</li>
  1855          <li><code>us</code> (microseconds)</li>
  1856          <li><code>ms</code> (milliseconds)</li>
  1857          <li><code>s</code> (seconds)</li>
  1858          <li><code>m</code> (minutes)</li>
  1859          <li><code>h</code> (hours)</li>
  1860        </ul>
  1861      If you omit the suffix, the system interprets the value as nanoseconds.
  1862      The default value is 10 seconds if this field is omitted.
  1863      </td>
  1864    </tr>
  1865  </table>
  1866  
  1867  ### http
  1868  
  1869  http is a list of HTTP URIs to be periodically checked with HEAD requests. If
  1870  a HEAD request doesn't complete or returns an unexpected status code, the
  1871  health check will fail.
  1872  
  1873  <table>
  1874    <tr>
  1875      <th>Parameter</th>
  1876      <th>Required</th>
  1877      <th>Description</th>
  1878    </tr>
  1879    <tr>
  1880      <td>
  1881        <code>uri</code>
  1882      </td>
  1883      <td>
  1884        yes
  1885      </td>
  1886      <td>
  1887  The URI to check.
  1888  </td>
  1889    </tr>
  1890     <tr>
  1891      <td>
  1892        <code>headers</code>
  1893      </td>
  1894      <td>
  1895        no
  1896      </td>
  1897      <td>
  1898        Static headers to add to each request. Each header's name should be a key
  1899        underneath headers, and each value is a list of payloads for that
  1900        header name. Note that values must always be lists.
  1901      </td>
  1902    </tr>
  1903    <tr>
  1904      <td>
  1905        <code>statuscode</code>
  1906      </td>
  1907      <td>
  1908        no
  1909      </td>
  1910      <td>
  1911  Expected status code from the HTTP URI. Defaults to 200.
  1912  </td>
  1913    </tr>
  1914    <tr>
  1915      <td>
  1916        <code>timeout</code>
  1917      </td>
  1918      <td>
  1919        no
  1920      </td>
  1921      <td>
  1922        The length of time to wait before timing out the HTTP request. This field
  1923        takes a positive integer and an optional suffix indicating the unit of
  1924        time. Possible units are:
  1925        <ul>
  1926          <li><code>ns</code> (nanoseconds)</li>
  1927          <li><code>us</code> (microseconds)</li>
  1928          <li><code>ms</code> (milliseconds)</li>
  1929          <li><code>s</code> (seconds)</li>
  1930          <li><code>m</code> (minutes)</li>
  1931          <li><code>h</code> (hours)</li>
  1932        </ul>
  1933      If you omit the suffix, the system interprets the value as nanoseconds.
  1934      </td>
  1935    </tr>
  1936    <tr>
  1937      <td>
  1938        <code>interval</code>
  1939      </td>
  1940      <td>
  1941        no
  1942      </td>
  1943      <td>
  1944        The length of time to wait between repetitions of the check. This field
  1945        takes a positive integer and an optional suffix indicating the unit of
  1946        time. Possible units are:
  1947        <ul>
  1948          <li><code>ns</code> (nanoseconds)</li>
  1949          <li><code>us</code> (microseconds)</li>
  1950          <li><code>ms</code> (milliseconds)</li>
  1951          <li><code>s</code> (seconds)</li>
  1952          <li><code>m</code> (minutes)</li>
  1953          <li><code>h</code> (hours)</li>
  1954        </ul>
  1955      If you omit the suffix, the system interprets the value as nanoseconds.
  1956      The default value is 10 seconds if this field is omitted.
  1957      </td>
  1958    </tr>
  1959    <tr>
  1960      <td>
  1961        <code>threshold</code>
  1962      </td>
  1963      <td>
  1964        no
  1965      </td>
  1966      <td>
  1967        An integer specifying the number of times the check must fail before the
  1968        check triggers an unhealthy state. If this filed is not specified, a
  1969        single failure will trigger an unhealthy state.
  1970      </td>
  1971    </tr>
  1972  </table>
  1973  
  1974  ### tcp
  1975  
  1976  tcp is a list of TCP addresses to be periodically checked with connection
  1977  attempts. The addresses must include port numbers. If a connection attempt
  1978  fails, the health check will fail.
  1979  
  1980  <table>
  1981    <tr>
  1982      <th>Parameter</th>
  1983      <th>Required</th>
  1984      <th>Description</th>
  1985    </tr>
  1986    <tr>
  1987      <td>
  1988        <code>addr</code>
  1989      </td>
  1990      <td>
  1991        yes
  1992      </td>
  1993      <td>
  1994  The TCP address to connect to, including a port number.
  1995  </td>
  1996    </tr>
  1997    <tr>
  1998      <td>
  1999        <code>timeout</code>
  2000      </td>
  2001      <td>
  2002        no
  2003      </td>
  2004      <td>
  2005        The length of time to wait before timing out the TCP connection. This
  2006        field takes a positive integer and an optional suffix indicating the unit
  2007        of time. Possible units are:
  2008        <ul>
  2009          <li><code>ns</code> (nanoseconds)</li>
  2010          <li><code>us</code> (microseconds)</li>
  2011          <li><code>ms</code> (milliseconds)</li>
  2012          <li><code>s</code> (seconds)</li>
  2013          <li><code>m</code> (minutes)</li>
  2014          <li><code>h</code> (hours)</li>
  2015        </ul>
  2016      If you omit the suffix, the system interprets the value as nanoseconds.
  2017      </td>
  2018    </tr>
  2019    <tr>
  2020      <td>
  2021        <code>interval</code>
  2022      </td>
  2023      <td>
  2024        no
  2025      </td>
  2026      <td>
  2027        The length of time to wait between repetitions of the check. This field
  2028        takes a positive integer and an optional suffix indicating the unit of
  2029        time. Possible units are:
  2030        <ul>
  2031          <li><code>ns</code> (nanoseconds)</li>
  2032          <li><code>us</code> (microseconds)</li>
  2033          <li><code>ms</code> (milliseconds)</li>
  2034          <li><code>s</code> (seconds)</li>
  2035          <li><code>m</code> (minutes)</li>
  2036          <li><code>h</code> (hours)</li>
  2037        </ul>
  2038      If you omit the suffix, the system interprets the value as nanoseconds.
  2039      The default value is 10 seconds if this field is omitted.
  2040      </td>
  2041    </tr>
  2042    <tr>
  2043      <td>
  2044        <code>threshold</code>
  2045      </td>
  2046      <td>
  2047        no
  2048      </td>
  2049      <td>
  2050        An integer specifying the number of times the check must fail before the
  2051        check triggers an unhealthy state. If this filed is not specified, a
  2052        single failure will trigger an unhealthy state.
  2053      </td>
  2054    </tr>
  2055  </table>
  2056  
  2057  ## Proxy
  2058  
  2059      proxy:
  2060        remoteurl: https://registry-1.docker.io
  2061        username: [username]
  2062        password: [password]
  2063  
  2064  Proxy enables a registry to be configured as a pull through cache to the official Docker Hub.  See [mirror](mirror.md) for more information. Pushing to a registry configured as a pull through cache is currently unsupported.
  2065  
  2066  <table>
  2067    <tr>
  2068      <th>Parameter</th>
  2069      <th>Required</th>
  2070      <th>Description</th>
  2071    </tr>
  2072    <tr>
  2073      <td>
  2074        <code>remoteurl</code>
  2075      </td>
  2076      <td>
  2077        yes
  2078      </td>
  2079      <td>
  2080       The URL of the official Docker Hub
  2081      </td>
  2082    </tr>
  2083    <tr>
  2084      <td>
  2085        <code>username</code>
  2086      </td>
  2087      <td>
  2088        no
  2089      </td>
  2090      <td>
  2091       The username of the Docker Hub account
  2092      </td>
  2093    </tr>
  2094    <tr>
  2095      <td>
  2096        <code>password</code>
  2097      </td>
  2098      <td>
  2099        no
  2100      </td>
  2101      <td>
  2102       The password for the official Docker Hub account
  2103      </td>
  2104    </tr>
  2105  </table>
  2106  
  2107  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.
  2108  
  2109  
  2110  ## Example: Development configuration
  2111  
  2112  The following is a simple example you can use for local development:
  2113  
  2114      version: 0.1
  2115      log:
  2116        level: debug
  2117      storage:
  2118          filesystem:
  2119              rootdirectory: /var/lib/registry
  2120      http:
  2121          addr: localhost:5000
  2122          secret: asecretforlocaldevelopment
  2123          debug:
  2124              addr: localhost:5001
  2125  
  2126  The above configures the registry instance to run on port `5000`, binding to
  2127  `localhost`, with the `debug` server enabled. Registry data storage is in the
  2128  `/var/lib/registry` directory. Logging is in `debug` mode, which is the most
  2129  verbose.
  2130  
  2131  A similar simple configuration is available at
  2132  [config-example.yml](https://github.com/docker/distribution/blob/master/cmd/registry/config-example.yml).
  2133  Both are generally useful for local development.
  2134  
  2135  
  2136  ## Example: Middleware configuration
  2137  
  2138  This example illustrates how to configure storage middleware in a registry.
  2139  Middleware allows the registry to serve layers via a content delivery network
  2140  (CDN). This is useful for reducing requests to the storage layer.
  2141  
  2142  Currently, the registry supports [Amazon
  2143  Cloudfront](http://aws.amazon.com/cloudfront/). You can only use Cloudfront in
  2144  conjunction with the S3 storage driver.
  2145  
  2146  <table>
  2147    <tr>
  2148      <th>Parameter</th>
  2149      <th>Description</th>
  2150    </tr>
  2151    <tr>
  2152      <td><code>name</code></td>
  2153      <td>The storage middleware name. Currently <code>cloudfront</code> is an accepted value.</td>
  2154    </tr>
  2155    <tr>
  2156      <td><code>disabled<code></td>
  2157      <td>Set to <code>false</code> to easily disable the middleware.</td>
  2158    </tr>
  2159    <tr>
  2160      <td><code>options:</code></td>
  2161      <td>
  2162      A set of key/value options to configure the middleware.
  2163      <ul>
  2164      <li><code>baseurl:</code> The Cloudfront base URL.</li>
  2165      <li><code>privatekey:</code> The location of your AWS private key on the filesystem. </li>
  2166      <li><code>keypairid:</code> The ID of your Cloudfront keypair. </li>
  2167      <li><code>duration:</code> The duration in minutes for which the URL is valid. Default is 20. </li>
  2168      </ul>
  2169      </td>
  2170    </tr>
  2171  </table>
  2172  
  2173  The following example illustrates these values:
  2174  
  2175      middleware:
  2176          storage:
  2177              - name: cloudfront
  2178                disabled: false
  2179                options:
  2180                   baseurl: http://d111111abcdef8.cloudfront.net
  2181                   privatekey: /path/to/asecret.pem
  2182                   keypairid: asecret
  2183                   duration: 60
  2184  
  2185  
  2186  >**Note**: Cloudfront keys exist separately to other AWS keys.  See
  2187  >[the documentation on AWS credentials](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html)
  2188  >for more information.