github.com/lusis/distribution@v2.0.1+incompatible/docs/spec/api.md.tmpl (about)

     1  <!--GITHUB
     2  page_title: Docker Registry HTTP API V2
     3  page_description: Explains how to use registry API
     4  page_keywords: registry, service, driver, images, storage, api
     5  IGNORES-->
     6  
     7  # Docker Registry HTTP API V2
     8  
     9  ## Introduction
    10  
    11  The _Docker Registry HTTP API_ is the protocol to facilitate distribution of
    12  images to the docker engine. It interacts with instances of the docker
    13  registry, which is a service to manage information about docker images and
    14  enable their distribution. The specification covers the operation of version 2
    15  of this API, known as _Docker Registry HTTP API V2_.
    16  
    17  While the V1 registry protocol is usable, there are several problems with the
    18  architecture that have led to this new version. The main driver of this
    19  specification these changes to the docker the image format, covered in
    20  docker/docker#8093. The new, self-contained image manifest simplifies image
    21  definition and improves security. This specification will build on that work,
    22  leveraging new properties of the manifest format to improve performance,
    23  reduce bandwidth usage and decrease the likelihood of backend corruption.
    24  
    25  For relevant details and history leading up to this specification, please see
    26  the following issues:
    27  
    28  - [docker/docker#8093](https://github.com/docker/docker/issues/8093)
    29  - [docker/docker#9015](https://github.com/docker/docker/issues/9015)
    30  - [docker/docker-registry#612](https://github.com/docker/docker-registry/issues/612)
    31  
    32  ### Scope
    33  
    34  This specification covers the URL layout and protocols of the interaction
    35  between docker registry and docker core. This will affect the docker core
    36  registry API and the rewrite of docker-registry. Docker registry
    37  implementations may implement other API endpoints, but they are not covered by
    38  this specification.
    39  
    40  This includes the following features:
    41  
    42  - Namespace-oriented URI Layout
    43  - PUSH/PULL registry server for V2 image manifest format
    44  - Resumable layer PUSH support
    45  - V2 Client library implementation
    46  
    47  While authentication and authorization support will influence this
    48  specification, details of the protocol will be left to a future specification.
    49  Relevant header definitions and error codes are present to provide an
    50  indication of what a client may encounter.
    51  
    52  #### Future
    53  
    54  There are features that have been discussed during the process of cutting this
    55  specification. The following is an incomplete list:
    56  
    57  - Immutable image references
    58  - Multiple architecture support
    59  - Migration from v2compatibility representation
    60  
    61  These may represent features that are either out of the scope of this
    62  specification, the purview of another specification or have been deferred to a
    63  future version.
    64  
    65  ### Use Cases
    66  
    67  For the most part, the use cases of the former registry API apply to the new
    68  version. Differentiating use cases are covered below.
    69  
    70  #### Image Verification
    71  
    72  A docker engine instance would like to run verified image named
    73  "library/ubuntu", with the tag "latest". The engine contacts the registry,
    74  requesting the manifest for "library/ubuntu:latest". An untrusted registry
    75  returns a manifest. Before proceeding to download the individual layers, the
    76  engine verifies the manifest's signature, ensuring that the content was
    77  produced from a trusted source and no tampering has occured. After each layer
    78  is downloaded, the engine verifies the digest of the layer, ensuring that the
    79  content matches that specified by the manifest.
    80  
    81  #### Resumable Push
    82  
    83  Company X's build servers lose connectivity to docker registry before
    84  completing an image layer transfer. After connectivity returns, the build
    85  server attempts to re-upload the image. The registry notifies the build server
    86  that the upload has already been partially attempted. The build server
    87  responds by only sending the remaining data to complete the image file.
    88  
    89  #### Resumable Pull
    90  
    91  Company X is having more connectivity problems but this time in their
    92  deployment datacenter. When downloading an image, the connection is
    93  interrupted before completion. The client keeps the partial data and uses http
    94  `Range` requests to avoid downloading repeated data.
    95  
    96  #### Layer Upload De-duplication
    97  
    98  Company Y's build system creates two identical docker layers from build
    99  processes A and B. Build process A completes uploading the layer before B.
   100  When process B attempts to upload the layer, the registry indicates that its
   101  not necessary because the layer is already known.
   102  
   103  If process A and B upload the same layer at the same time, both operations
   104  will proceed and the first to complete will be stored in the registry (Note:
   105  we may modify this to prevent dogpile with some locking mechanism).
   106  
   107  ### Changes
   108  
   109  The V2 specification has been written to work as a living document, specifying
   110  only what is certain and leaving what is not specified open or to future
   111  changes. Only non-conflicting additions should be made to the API and accepted
   112  changes should avoid preventing future changes from happening.
   113  
   114  This section should be updated when changes are made to the specification,
   115  indicating what is different. Optionally, we may start marking parts of the
   116  specification to correspond with the versions enumerated here.
   117  
   118  <dl>
   119  	<dt>2.0.1</dt>
   120  	<dd>
   121  		<ul>
   122  			<li>Added capability of doing streaming upload to PATCH blob upload.</li>
   123  			<li>Updated PUT blob upload to no longer take final chunk, now requires entire data or no data.</li>
   124  			<li>Removed `416 Requested Range Not Satisfiable` response status from PUT blob upload.</li>
   125  		</ul>
   126  	</dd>
   127  
   128  	<dt>2.0.0</dt>
   129  	<dd>
   130  		<ul>
   131  			<li>Added support for immutable manifest references in manifest endpoints.</li>
   132  			<li>Deleting a manifest by tag has been deprecated.</li>
   133  			<li>Specified `Docker-Content-Digest` header for appropriate entities.</li>
   134  			<li>Added error code for unsupported operations.</li>
   135  			<li>Added capability of doing streaming upload to PATCH blob upload.</li>
   136  			<li>Updated PUT blob upload to no longer take final chunk, now requires entire data or no data.</li>
   137  			<li>Removed 416 return code from PUT blob upload.</li>
   138  		</ul>
   139  	</dd>
   140  
   141  	<dt>2.0</dt>
   142  	<dd>
   143  		This is the baseline specification.
   144  	</dd>
   145  </dl>
   146  
   147  ## Overview
   148  
   149  This section covers client flows and details of the API endpoints. The URI
   150  layout of the new API is structured to support a rich authentication and
   151  authorization model by leveraging namespaces. All endpoints will be prefixed
   152  by the API version and the repository name:
   153  
   154      /v2/<name>/
   155  
   156  For example, an API endpoint that will work with the `library/ubuntu`
   157  repository, the URI prefix will be:
   158  
   159      /v2/library/ubuntu/
   160  
   161  This scheme provides rich access control over various operations and methods
   162  using the URI prefix and http methods that can be controlled in variety of
   163  ways.
   164  
   165  Classically, repository names have always been two path components where each
   166  path component is less than 30 characters. The V2 registry API does not
   167  enforce this. The rules for a repository name are as follows:
   168  
   169  1. A repository name is broken up into _path components_. A component of a
   170     repository name must be at least two lowercase, alpha-numeric characters,
   171     optionally separated by periods, dashes or underscores. More strictly, it
   172     must match the regular expression `[a-z0-9]+(?:[._-][a-z0-9]+)*` and the
   173     matched result must be 2 or more characters in length.
   174  2. The name of a repository must have at least two path components, separated
   175     by a forward slash.
   176  3. The total length of a repository name, including slashes, must be less the
   177     256 characters.
   178  
   179  These name requirements _only_ apply to the registry API and should accept a
   180  superset of what is supported by other docker ecosystem components.
   181  
   182  All endpoints should support aggressive http caching, compression and range
   183  headers, where appropriate. The new API attempts to leverage HTTP semantics
   184  where possible but may break from standards to implement targeted features.
   185  
   186  For detail on individual endpoints, please see the [_Detail_](#detail)
   187  section.
   188  
   189  ### Errors
   190  
   191  Actionable failure conditions, covered in detail in their relevant sections,
   192  are reported as part of 4xx responses, in a json response body. One or more
   193  errors will be returned in the following format:
   194  
   195      {
   196          "errors:" [{
   197                  "code": <error identifier>,
   198                  "message": <message describing condition>,
   199                  "detail": <unstructured>
   200              },
   201              ...
   202          ]
   203      }
   204  
   205  The `code` field will be a unique identifier, all caps with underscores by
   206  convention. The `message` field will be a human readable string. The optional
   207  `detail` field may contain arbitrary json data providing information the
   208  client can use to resolve the issue.
   209  
   210  While the client can take action on certain error codes, the registry may add
   211  new error codes over time. All client implementations should treat unknown
   212  error codes as `UNKNOWN`, allowing future error codes to be added without
   213  breaking API compatibility. For the purposes of the specification error codes
   214  will only be added and never removed.
   215  
   216  For a complete account of all error codes, please see the _Detail_ section.
   217  
   218  ### API Version Check
   219  
   220  A minimal endpoint, mounted at `/v2/` will provide version support information
   221  based on its response statuses. The request format is as follows:
   222  
   223      GET /v2/
   224  
   225  If a `200 OK` response is returned, the registry implements the V2(.1)
   226  registry API and the client may proceed safely with other V2 operations.
   227  Optionally, the response may contain information about the supported paths in
   228  the response body. The client should be prepared to ignore this data.
   229  
   230  If a `401 Unauthorized` response is returned, the client should take action
   231  based on the contents of the "WWW-Authenticate" header and try the endpoint
   232  again. Depending on access control setup, the client may still have to
   233  authenticate against different resources, even if this check succeeds.
   234  
   235  If `404 Not Found` response status, or other unexpected status, is returned,
   236  the client should proceed with the assumption that the registry does not
   237  implement V2 of the API.
   238  
   239  When a `200 OK` or `401 Unauthorized` response is returned, the
   240  "Docker-Distribution-API-Version" header should be set to "registry/2.0".
   241  Clients may require this header value to determine if the endpoint serves this
   242  API. When this header is omitted, clients may fallback to an older API version.
   243  
   244  ### Pulling An Image
   245  
   246  An "image" is a combination of a JSON manifest and individual layer files. The
   247  process of pulling an image centers around retrieving these two components.
   248  
   249  The first step in pulling an image is to retrieve the manifest. For reference,
   250  the relevant manifest fields for the registry are the following:
   251  
   252   field    | description                                    |
   253  ----------|------------------------------------------------|
   254  name      | The name of the image.                         |
   255  tag       | The tag for this version of the image.         |
   256  fsLayers  | A list of layer descriptors (including tarsum) |
   257  signature | A JWS used to verify the manifest content      |
   258  
   259  For more information about the manifest format, please see
   260  [docker/docker#8093](https://github.com/docker/docker/issues/8093).
   261  
   262  When the manifest is in hand, the client must verify the signature to ensure
   263  the names and layers are valid. Once confirmed, the client will then use the
   264  tarsums to download the individual layers. Layers are stored in as blobs in
   265  the V2 registry API, keyed by their tarsum digest.
   266  
   267  #### Pulling an Image Manifest
   268  
   269  The image manifest can be fetched with the following url:
   270  
   271  ```
   272  GET /v2/<name>/manifests/<reference>
   273  ```
   274  
   275  The `name` and `reference` parameter identify the image and are required. The
   276  reference may include a tag or digest.
   277  
   278  A `404 Not Found` response will be returned if the image is unknown to the
   279  registry. If the image exists and the response is successful, the image
   280  manifest will be returned, with the following format (see docker/docker#8093
   281  for details):
   282  
   283      {
   284         "name": <name>,
   285         "tag": <tag>,
   286         "fsLayers": [
   287            {
   288               "blobSum": <tarsum>
   289            },
   290            ...
   291          ]
   292         ],
   293         "history": <v1 images>,
   294         "signature": <JWS>
   295      }
   296  
   297  The client should verify the returned manifest signature for authenticity
   298  before fetching layers.
   299  
   300  #### Pulling a Layer
   301  
   302  Layers are stored in the blob portion of the registry, keyed by tarsum digest.
   303  Pulling a layer is carried out by a standard http request. The URL is as
   304  follows:
   305  
   306      GET /v2/<name>/blobs/<tarsum>
   307  
   308  Access to a layer will be gated by the `name` of the repository but is
   309  identified uniquely in the registry by `tarsum`. The `tarsum` parameter is an
   310  opaque field, to be interpreted by the tarsum library.
   311  
   312  This endpoint may issue a 307 (302 for <HTTP 1.1) redirect to another service
   313  for downloading the layer and clients should be prepared to handle redirects.
   314  
   315  This endpoint should support aggressive HTTP caching for image layers. Support
   316  for Etags, modification dates and other cache control headers should be
   317  included. To allow for incremental downloads, `Range` requests should be
   318  supported, as well.
   319  
   320  ### Pushing An Image
   321  
   322  Pushing an image works in the opposite order as a pull. After assembling the
   323  image manifest, the client must first push the individual layers. When the
   324  layers are fully pushed into the registry, the client should upload the signed
   325  manifest.
   326  
   327  The details of each step of the process are covered in the following sections.
   328  
   329  #### Pushing a Layer
   330  
   331  All layer uploads use two steps to manage the upload process. The first step
   332  starts the upload in the registry service, returning a url to carry out the
   333  second step. The second step uses the upload url to transfer the actual data.
   334  Uploads are started with a POST request which returns a url that can be used
   335  to push data and check upload status.
   336  
   337  The `Location` header will be used to communicate the upload location after
   338  each request. While it won't change in the this specification, clients should
   339  use the most recent value returned by the API.
   340  
   341  ##### Starting An Upload
   342  
   343  To begin the process, a POST request should be issued in the following format:
   344  
   345  ```
   346  POST /v2/<name>/blobs/uploads/
   347  ```
   348  
   349  The parameters of this request are the image namespace under which the layer
   350  will be linked. Responses to this request are covered below.
   351  
   352  ##### Existing Layers
   353  
   354  The existence of a layer can be checked via a `HEAD` request to the blob store
   355  API. The request should be formatted as follows:
   356  
   357  ```
   358  HEAD /v2/<name>/blobs/<digest>
   359  ```
   360  
   361  If the layer with the tarsum specified in `digest` is available, a 200 OK
   362  response will be received, with no actual body content (this is according to
   363  http specification). The response will look as follows:
   364  
   365  ```
   366  200 OK
   367  Content-Length: <length of blob>
   368  Docker-Content-Digest: <digest>
   369  ```
   370  
   371  When this response is received, the client can assume that the layer is
   372  already available in the registry under the given name and should take no
   373  further action to upload the layer. Note that the binary digests may differ
   374  for the existing registry layer, but the tarsums will be guaranteed to match.
   375  
   376  ##### Uploading the Layer
   377  
   378  If the POST request is successful, a `202 Accepted` response will be returned
   379  with the upload URL in the `Location` header:
   380  
   381  ```
   382  202 Accepted
   383  Location: /v2/<name>/blobs/uploads/<uuid>
   384  Range: bytes=0-<offset>
   385  Content-Length: 0
   386  Docker-Upload-UUID: <uuid>
   387  ```
   388  
   389  The rest of the upload process can be carried out with the returned url,
   390  called the "Upload URL" from the `Location` header. All responses to the
   391  upload url, whether sending data or getting status, will be in this format.
   392  Though the URI format (`/v2/<name>/blobs/uploads/<uuid>`) for the `Location`
   393  header is specified, clients should treat it as an opaque url and should never
   394  try to assemble the it. While the `uuid` parameter may be an actual UUID, this
   395  proposal imposes no constraints on the format and clients should never impose
   396  any.
   397  
   398  If clients need to correlate local upload state with remote upload state, the
   399  contents of the `Docker-Upload-UUID` header should be used. Such an id can be
   400  used to key the last used location header when implementing resumable uploads.
   401  
   402  ##### Upload Progress
   403  
   404  The progress and chunk coordination of the upload process will be coordinated
   405  through the `Range` header. While this is a non-standard use of the `Range`
   406  header, there are examples of [similar approaches](https://developers.google.com/youtube/v3/guides/using_resumable_upload_protocol) in APIs with heavy use.
   407  For an upload that just started, for an example with a 1000 byte layer file,
   408  the `Range` header would be as follows:
   409  
   410  ```
   411  Range: bytes=0-0
   412  ```
   413  
   414  To get the status of an upload, issue a GET request to the upload URL:
   415  
   416  ```
   417  GET /v2/<name>/blobs/uploads/<uuid>
   418  Host: <registry host>
   419  ```
   420  
   421  The response will be similar to the above, except will return 204 status:
   422  
   423  ```
   424  204 No Content
   425  Location: /v2/<name>/blobs/uploads/<uuid>
   426  Range: bytes=0-<offset>
   427  Docker-Upload-UUID: <uuid>
   428  ```
   429  
   430  Note that the HTTP `Range` header byte ranges are inclusive and that will be
   431  honored, even in non-standard use cases.
   432  
   433  ##### Monolithic Upload
   434  
   435  A monolithic upload is simply a chunked upload with a single chunk and may be
   436  favored by clients that would like to avoided the complexity of chunking. To
   437  carry out a "monolithic" upload, one can simply put the entire content blob to
   438  the provided URL:
   439  
   440  ```
   441  PUT /v2/<name>/blobs/uploads/<uuid>?digest=<tarsum>[&digest=sha256:<hex digest>]
   442  Content-Length: <size of layer>
   443  Content-Type: application/octet-stream
   444  
   445  <Layer Binary Data>
   446  ```
   447  
   448  The "digest" parameter must be included with the PUT request. Please see the
   449  _Completed Upload_ section for details on the parameters and expected
   450  responses.
   451  
   452  Additionally, the upload can be completed with a single `POST` request to
   453  the uploads endpoint, including the "size" and "digest" parameters:
   454  
   455  ```
   456  POST /v2/<name>/blobs/uploads/?digest=<tarsum>[&digest=sha256:<hex digest>]
   457  Content-Length: <size of layer>
   458  Content-Type: application/octet-stream
   459    
   460  <Layer Binary Data>
   461  ```
   462  
   463  On the registry service, this should allocate a download, accept and verify
   464  the data and return the same  response as the final chunk of an upload. If the
   465  POST request fails collecting the data in any way, the registry should attempt
   466  to return an error response to the client with the `Location` header providing
   467  a place to continue the download.
   468  
   469  The single `POST` method is provided for convenience and most clients should
   470  implement `POST` + `PUT` to support reliable resume of uploads.
   471    
   472  ##### Chunked Upload
   473  
   474  To carry out an upload of a chunk, the client can specify a range header and
   475  only include that part of the layer file:
   476  
   477  ```
   478  PATCH /v2/<name>/blobs/uploads/<uuid>
   479  Content-Length: <size of chunk>
   480  Content-Range: <start of range>-<end of range>
   481  Content-Type: application/octet-stream
   482  
   483  <Layer Chunk Binary Data>
   484  ```
   485  
   486  There is no enforcement on layer chunk splits other than that the server must
   487  receive them in order. The server may enforce a minimum chunk size. If the
   488  server cannot accept the chunk, a `416 Requested Range Not Satisfiable`
   489  response will be returned and will include a `Range` header indicating the
   490  current status:
   491  
   492  ```
   493  416 Requested Range Not Satisfiable
   494  Location: /v2/<name>/blobs/uploads/<uuid>
   495  Range: 0-<last valid range>
   496  Content-Length: 0
   497  Docker-Upload-UUID: <uuid>
   498  ```
   499  
   500  If this response is received, the client should resume from the "last valid
   501  range" and upload the subsequent chunk. A 416 will be returned under the
   502  following conditions:
   503  
   504  - Invalid Content-Range header format
   505  - Out of order chunk: the range of the next chunk must start immediately after
   506    the "last valid range" from the previous response.
   507  
   508  When a chunk is accepted as part of the upload, a `202 Accepted` response will
   509  be returned, including a `Range` header with the current upload status:
   510  
   511  ```
   512  202 Accepted
   513  Location: /v2/<name>/blobs/uploads/<uuid>
   514  Range: bytes=0-<offset>
   515  Content-Length: 0
   516  Docker-Upload-UUID: <uuid>
   517  ```
   518  
   519  ##### Completed Upload
   520  
   521  For an upload to be considered complete, the client must submit a `PUT`
   522  request on the upload endpoint with a digest parameter. If it is not provided,
   523  the upload will not be considered complete. The format for the final chunk
   524  will be as follows:
   525  
   526  ```
   527  PUT /v2/<name>/blob/uploads/<uuid>?digest=<tarsum>[&digest=sha256:<hex digest>]
   528  Content-Length: <size of chunk>
   529  Content-Range: <start of range>-<end of range>
   530  Content-Type: application/octet-stream
   531  
   532  <Last Layer Chunk Binary Data>
   533  ```
   534  
   535  Optionally, if all chunks have already been uploaded, a `PUT` request with a
   536  `digest` parameter and zero-length body may be sent to complete and validated
   537  the upload. Multiple "digest" parameters may be provided with different
   538  digests. The server may verify none or all of them but _must_ notify the
   539  client if the content is rejected.
   540  
   541  When the last chunk is received and the layer has been validated, the client
   542  will receive a `201 Created` response:
   543  
   544  ```
   545  201 Created
   546  Location: /v2/<name>/blobs/<tarsum>
   547  Content-Length: 0
   548  Docker-Content-Digest: <digest>
   549  ```
   550  
   551  The `Location` header will contain the registry URL to access the accepted
   552  layer file. The `Docker-Content-Digest` header returns the canonical digest of
   553  the uploaded blob which may differ from the provided digest. Most clients may
   554  ignore the value but if it is used, the client should verify the value against
   555  the uploaded blob data.
   556  
   557  ###### Digest Parameter
   558  
   559  The "digest" parameter is designed as an opaque parameter to support
   560  verification of a successful transfer. The initial version of the registry API
   561  will support a tarsum digest, in the standard tarsum format. For example, a
   562  HTTP URI parameter might be as follows:
   563  
   564  ```
   565  tarsum.v1+sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b
   566  ```
   567  
   568  Given this parameter, the registry will verify that the provided content does
   569  result in this tarsum. Optionally, the registry can support other other digest
   570  parameters for non-tarfile content stored as a layer. A regular hash digest
   571  might be specified as follows:
   572  
   573  ```
   574  sha256:6c3c624b58dbbcd3c0dd82b4c53f04194d1247c6eebdaab7c610cf7d66709b3b
   575  ```
   576  
   577  Such a parameter would be used to verify that the binary content (as opposed
   578  to the tar content) would be verified at the end of the upload process.
   579  
   580  For the initial version, registry servers are only required to support the
   581  tarsum format.
   582  
   583  ##### Canceling an Upload
   584  
   585  An upload can be cancelled by issuing a DELETE request to the upload endpoint.
   586  The format will be as follows:
   587  
   588  ```
   589  DELETE /v2/<name>/blobs/uploads/<uuid>
   590  ```
   591  
   592  After this request is issued, the upload uuid will no longer be valid and the
   593  registry server will dump all intermediate data. While uploads will time out
   594  if not completed, clients should issue this request if they encounter a fatal
   595  error but still have the ability to issue an http request.
   596  
   597  ##### Errors
   598  
   599  If an 502, 503 or 504 error is received, the client should assume that the
   600  download can proceed due to a temporary condition, honoring the appropriate
   601  retry mechanism. Other 5xx errors should be treated as terminal.
   602  
   603  If there is a problem with the upload, a 4xx error will be returned indicating
   604  the problem. After receiving a 4xx response (except 416, as called out above),
   605  the upload will be considered failed and the client should take appropriate
   606  action.
   607  
   608  Note that the upload url will not be available forever. If the upload uuid is
   609  unknown to the registry, a `404 Not Found` response will be returned and the
   610  client must restart the upload process.
   611  
   612  #### Pushing an Image Manifest
   613  
   614  Once all of the layers for an image are uploaded, the client can upload the
   615  image manifest. An image can be pushed using the following request format:
   616  
   617      PUT /v2/<name>/manifests/<reference>
   618  
   619      {
   620         "name": <name>,
   621         "tag": <tag>,
   622         "fsLayers": [
   623            {
   624               "blobSum": <tarsum>
   625            },
   626            ...
   627          ]
   628         ],
   629         "history": <v1 images>,
   630         "signature": <JWS>,
   631         ...
   632      }
   633  
   634  The `name` and `reference` fields of the response body must match those specified in
   635  the URL. The `reference` field may be a "tag" or a "digest".
   636  
   637  If there is a problem with pushing the manifest, a relevant 4xx response will
   638  be returned with a JSON error message. Please see the _PUT Manifest section
   639  for details on possible error codes that may be returned.
   640  
   641  If one or more layers are unknown to the registry, `BLOB_UNKNOWN` errors are
   642  returned. The `detail` field of the error response will have a `digest` field
   643  identifying the missing blob, which will be a tarsum. An error is returned for
   644  each unknown blob. The response format is as follows:
   645  
   646      {
   647          "errors:" [{
   648                  "code": "BLOB_UNKNOWN",
   649                  "message": "blob unknown to registry",
   650                  "detail": {
   651                      "digest": <tarsum>
   652                  }
   653              },
   654              ...
   655          ]
   656      }
   657  
   658  #### Listing Image Tags
   659  
   660  It may be necessary to list all of the tags under a given repository. The tags
   661  for an image repository can be retrieved with the following request:
   662  
   663      GET /v2/<name>/tags/list
   664  
   665  The response will be in the following format:
   666  
   667      200 OK
   668      Content-Type: application/json
   669  
   670      {
   671          "name": <name>,
   672          "tags": [
   673              <tag>,
   674              ...
   675          ]
   676      }
   677  
   678  For repositories with a large number of tags, this response may be quite
   679  large, so care should be taken by the client when parsing the response to
   680  reduce copying.
   681  
   682  ### Deleting an Image
   683  
   684  An image may be deleted from the registry via its `name` and `reference`. A
   685  delete may be issued with the following request format:
   686  
   687      DELETE /v2/<name>/manifests/<reference>
   688  
   689  For deletes, `reference` *must* be a digest or the delete will fail. If the
   690  image exists and has been successfully deleted, the following response will be
   691  issued:
   692  
   693      202 Accepted
   694      Content-Length: None
   695  
   696  If the image had already been deleted or did not exist, a `404 Not Found`
   697  response will be issued instead.
   698  
   699  ## Detail
   700  
   701  > **Note**: This section is still under construction. For the purposes of
   702  > implementation, if any details below differ from the described request flows
   703  > above, the section below should be corrected. When they match, this note
   704  > should be removed.
   705  
   706  The behavior of the endpoints are covered in detail in this section, organized
   707  by route and entity. All aspects of the request and responses are covered,
   708  including headers, parameters and body formats. Examples of requests and their
   709  corresponding responses, with success and failure, are enumerated.
   710  
   711  > **Note**: The sections on endpoint detail are arranged with an example
   712  > request, a description of the request, followed by information about that
   713  > request.
   714  
   715  A list of methods and URIs are covered in the table below:
   716  
   717  |Method|Path|Entity|Description|
   718  -------|----|------|------------
   719  {{range $route := .RouteDescriptors}}{{range $method := .Methods}}| {{$method.Method}} | `{{$route.Path|prettygorilla}}` | {{$route.Entity}} | {{$method.Description}} |
   720  {{end}}{{end}}
   721  
   722  The detail for each endpoint is covered in the following sections.
   723  
   724  ### Errors
   725  
   726  The error codes encountered via the API are enumerated in the following table:
   727  
   728  |Code|Message|Description|
   729  -------|----|------|------------
   730  {{range $err := .ErrorDescriptors}} `{{$err.Value}}` | {{$err.Message}} | {{$err.Description|removenewlines}}
   731  {{end}}
   732  
   733  {{range $route := .RouteDescriptors}}
   734  ### {{.Entity}}
   735  
   736  {{.Description}}
   737  
   738  {{range $method := $route.Methods}}
   739  
   740  #### {{.Method}} {{$route.Entity}}
   741  
   742  {{.Description}}
   743  
   744  {{if .Requests}}{{range .Requests}}{{if .Name}}
   745  ##### {{.Name}}{{end}}
   746  
   747  ```
   748  {{$method.Method}} {{$route.Path|prettygorilla}}{{if .QueryParameters}}?{{range .QueryParameters}}{{.Name}}={{.Format}}{{end}}{{end}}{{range .Headers}}
   749  {{.Name}}: {{.Format}}{{end}}{{if .Body.ContentType}}
   750  Content-Type: {{.Body.ContentType}}{{end}}{{if .Body.Format}}
   751  
   752  {{.Body.Format}}{{end}}
   753  ```
   754  
   755  {{.Description}}
   756  
   757  {{if or .Headers .PathParameters .QueryParameters}}
   758  The following parameters should be specified on the request:
   759  
   760  |Name|Kind|Description|
   761  |----|----|-----------|
   762  {{range .Headers}}|`{{.Name}}`|header|{{.Description}}|
   763  {{end}}{{range .PathParameters}}|`{{.Name}}`|path|{{.Description}}|
   764  {{end}}{{range .QueryParameters}}|`{{.Name}}`|query|{{.Description}}|
   765  {{end}}{{end}}
   766  
   767  {{if .Successes}}
   768  {{range .Successes}}
   769  ###### On Success: {{if .Name}}{{.Name}}{{else}}{{.StatusCode | statustext}}{{end}}
   770  
   771  ```
   772  {{.StatusCode}} {{.StatusCode | statustext}}{{range .Headers}}
   773  {{.Name}}: {{.Format}}{{end}}{{if .Body.ContentType}}
   774  Content-Type: {{.Body.ContentType}}{{end}}{{if .Body.Format}}
   775  
   776  {{.Body.Format}}{{end}}
   777  ```
   778  
   779  {{.Description}}
   780  
   781  {{if .Headers}}The following headers will be returned with the response:
   782  
   783  |Name|Description|
   784  |----|-----------|
   785  {{range .Headers}}|`{{.Name}}`|{{.Description}}|
   786  {{end}}{{end}}{{end}}{{end}}
   787  
   788  {{if .Failures}}
   789  {{range .Failures}}
   790  ###### On Failure: {{if .Name}}{{.Name}}{{else}}{{.StatusCode | statustext}}{{end}}
   791  
   792  ```
   793  {{.StatusCode}} {{.StatusCode | statustext}}{{range .Headers}}
   794  {{.Name}}: {{.Format}}{{end}}{{if .Body.ContentType}}
   795  Content-Type: {{.Body.ContentType}}{{end}}{{if .Body.Format}}
   796  
   797  {{.Body.Format}}{{end}}
   798  ```
   799  
   800  {{.Description}}
   801  {{if .Headers}}
   802  The following headers will be returned on the response:
   803  
   804  |Name|Description|
   805  |----|-----------|
   806  {{range .Headers}}|`{{.Name}}`|{{.Description}}|
   807  {{end}}{{end}}
   808  
   809  {{if .ErrorCodes}}
   810  The error codes that may be included in the response body are enumerated below:
   811  
   812  |Code|Message|Description|
   813  -------|----|------|------------
   814  {{range $err := .ErrorCodes}}| `{{$err}}` | {{$err.Descriptor.Message}} | {{$err.Descriptor.Description|removenewlines}} |
   815  {{end}}
   816  
   817  {{end}}{{end}}{{end}}{{end}}{{end}}{{end}}
   818  
   819  {{end}}