github.com/daaku/docker@v1.5.0/docs/sources/reference/api/registry_api.md (about)

     1  page_title: Registry API
     2  page_description: API Documentation for Docker Registry
     3  page_keywords: API, Docker, index, registry, REST, documentation
     4  
     5  # Docker Registry API
     6  
     7  ## Introduction
     8  
     9   - This is the REST API for the Docker Registry
    10   - It stores the images and the graph for a set of repositories
    11   - It does not have user accounts data
    12   - It has no notion of user accounts or authorization
    13   - It delegates authentication and authorization to the Index Auth
    14     service using tokens
    15   - It supports different storage backends (S3, cloud files, local FS)
    16   - It doesn't have a local database
    17   - The registry is open source: [Docker Registry](https://github.com/docker/docker-registry)
    18  
    19   We expect that there will be multiple registries out there. To help to
    20  grasp the context, here are some examples of registries:
    21  
    22   - **sponsor registry**: such a registry is provided by a third-party
    23     hosting infrastructure as a convenience for their customers and the
    24     Docker community as a whole. Its costs are supported by the third
    25     party, but the management and operation of the registry are
    26     supported by Docker. It features read/write access, and delegates
    27     authentication and authorization to the Index.
    28   - **mirror registry**: such a registry is provided by a third-party
    29     hosting infrastructure but is targeted at their customers only. Some
    30     mechanism (unspecified to date) ensures that public images are
    31     pulled from a sponsor registry to the mirror registry, to make sure
    32     that the customers of the third-party provider can `docker pull`
    33     those images locally.
    34   - **vendor registry**: such a registry is provided by a software
    35     vendor, who wants to distribute Docker images. It would be operated
    36     and managed by the vendor. Only users authorized by the vendor would
    37     be able to get write access. Some images would be public (accessible
    38     for anyone), others private (accessible only for authorized users).
    39     Authentication and authorization would be delegated to the Index.
    40     The goal of vendor registries is to let someone do `docker pull
    41     basho/riak1.3` and automatically push from the vendor registry
    42     (instead of a sponsor registry); i.e., get all the convenience of a
    43     sponsor registry, while retaining control on the asset distribution.
    44   - **private registry**: such a registry is located behind a firewall,
    45     or protected by an additional security layer (HTTP authorization,
    46     SSL client-side certificates, IP address authorization...). The
    47     registry is operated by a private entity, outside of Docker's
    48     control. It can optionally delegate additional authorization to the
    49     Index, but it is not mandatory.
    50  
    51  > **Note**:
    52  > Mirror registries and private registries which do not use the Index
    53  > don't even need to run the registry code. They can be implemented by any
    54  > kind of transport implementing HTTP GET and PUT. Read-only registries
    55  > can be powered by a simple static HTTPS server.
    56  
    57  > **Note**:
    58  > The latter implies that while HTTP is the protocol of choice for a registry,
    59  > multiple schemes are possible (and in some cases, trivial):
    60  >
    61  >  - HTTP with GET (and PUT for read-write registries);
    62  >  - local mount point;
    63  >  - remote Docker addressed through SSH.
    64  
    65  The latter would only require two new commands in Docker, e.g.,
    66  `registryget` and `registryput`, wrapping access to the local filesystem
    67  (and optionally doing consistency checks). Authentication and authorization
    68  are then delegated to SSH (e.g., with public keys).
    69  
    70  > **Note**:
    71  > Private registry servers that expose an HTTP endpoint need to be secured with
    72  > TLS (preferably TLSv1.2, but at least TLSv1.0). Make sure to put the CA
    73  > certificate at /etc/docker/certs.d/my.registry.com:5000/ca.crt on the Docker
    74  > host, so that the daemon can securely access the private registry.
    75  > Support for SSLv3 and lower is not available due to security issues.
    76  
    77  The default namespace for a private repository is `library`.
    78  
    79  # Endpoints
    80  
    81  ## Images
    82  
    83  ### Get image layer
    84  
    85  `GET /v1/images/(image_id)/layer`
    86  
    87  Get image layer for a given `image_id`
    88  
    89  **Example Request**:
    90  
    91          GET /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/layer HTTP/1.1
    92          Host: registry-1.docker.io
    93          Accept: application/json
    94          Content-Type: application/json
    95          Authorization: Token signature=123abc,repository="foo/bar",access=read
    96  
    97  Parameters:
    98  
    99  - **image_id** – the id for the layer you want to get
   100  
   101  **Example Response**:
   102  
   103          HTTP/1.1 200
   104          Vary: Accept
   105          X-Docker-Registry-Version: 0.6.0
   106          Cookie: (Cookie provided by the Registry)
   107  
   108          {layer binary data stream}
   109  
   110  Status Codes:
   111  
   112  - **200** – OK
   113  - **401** – Requires authorization
   114  - **404** – Image not found
   115  
   116  ### Put image layer
   117  
   118  `PUT /v1/images/(image_id)/layer`
   119  
   120  Put image layer for a given `image_id`
   121  
   122  **Example Request**:
   123  
   124          PUT /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/layer HTTP/1.1
   125          Host: registry-1.docker.io
   126          Transfer-Encoding: chunked
   127          Authorization: Token signature=123abc,repository="foo/bar",access=write
   128  
   129          {layer binary data stream}
   130  
   131  Parameters:
   132  
   133  - **image_id** – the id for the layer you want to get
   134  
   135  **Example Response**:
   136  
   137          HTTP/1.1 200
   138          Vary: Accept
   139          Content-Type: application/json
   140          X-Docker-Registry-Version: 0.6.0
   141  
   142          ""
   143  
   144  Status Codes:
   145  
   146  - **200** – OK
   147  - **401** – Requires authorization
   148  - **404** – Image not found
   149  
   150  ## Image
   151  
   152  ### Put image layer
   153  
   154  `PUT /v1/images/(image_id)/json`
   155  
   156  Put image for a given `image_id`
   157  
   158  **Example Request**:
   159  
   160          PUT /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/json HTTP/1.1
   161          Host: registry-1.docker.io
   162          Accept: application/json
   163          Content-Type: application/json
   164          Cookie: (Cookie provided by the Registry)
   165  
   166          {
   167              id: "088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c",
   168              parent: "aeee6396d62273d180a49c96c62e45438d87c7da4a5cf5d2be6bee4e21bc226f",
   169              created: "2013-04-30T17:46:10.843673+03:00",
   170              container: "8305672a76cc5e3d168f97221106ced35a76ec7ddbb03209b0f0d96bf74f6ef7",
   171              container_config: {
   172                  Hostname: "host-test",
   173                  User: "",
   174                  Memory: 0,
   175                  MemorySwap: 0,
   176                  AttachStdin: false,
   177                  AttachStdout: false,
   178                  AttachStderr: false,
   179                  PortSpecs: null,
   180                  Tty: false,
   181                  OpenStdin: false,
   182                  StdinOnce: false,
   183                  Env: null,
   184                  Cmd: [
   185                  "/bin/bash",
   186                  "-c",
   187                  "apt-get -q -yy -f install libevent-dev"
   188                  ],
   189                  Dns: null,
   190                  Image: "imagename/blah",
   191                  Volumes: { },
   192                  VolumesFrom: ""
   193              },
   194              docker_version: "0.1.7"
   195          }
   196  
   197  Parameters:
   198  
   199  - **image_id** – the id for the layer you want to get
   200  
   201  **Example Response**:
   202  
   203          HTTP/1.1 200
   204          Vary: Accept
   205          Content-Type: application/json
   206          X-Docker-Registry-Version: 0.6.0
   207  
   208          ""
   209  
   210  Status Codes:
   211  
   212  - **200** – OK
   213  - **401** – Requires authorization
   214  
   215  ### Get image layer
   216  
   217  `GET /v1/images/(image_id)/json`
   218  
   219  Get image for a given `image_id`
   220  
   221  **Example Request**:
   222  
   223          GET /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/json HTTP/1.1
   224          Host: registry-1.docker.io
   225          Accept: application/json
   226          Content-Type: application/json
   227          Cookie: (Cookie provided by the Registry)
   228  
   229  Parameters:
   230  
   231  - **image_id** – the id for the layer you want to get
   232  
   233  **Example Response**:
   234  
   235          HTTP/1.1 200
   236          Vary: Accept
   237          Content-Type: application/json
   238          X-Docker-Registry-Version: 0.6.0
   239          X-Docker-Size: 456789
   240          X-Docker-Checksum: b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087
   241  
   242          {
   243              id: "088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c",
   244              parent: "aeee6396d62273d180a49c96c62e45438d87c7da4a5cf5d2be6bee4e21bc226f",
   245              created: "2013-04-30T17:46:10.843673+03:00",
   246              container: "8305672a76cc5e3d168f97221106ced35a76ec7ddbb03209b0f0d96bf74f6ef7",
   247              container_config: {
   248                  Hostname: "host-test",
   249                  User: "",
   250                  Memory: 0,
   251                  MemorySwap: 0,
   252                  AttachStdin: false,
   253                  AttachStdout: false,
   254                  AttachStderr: false,
   255                  PortSpecs: null,
   256                  Tty: false,
   257                  OpenStdin: false,
   258                  StdinOnce: false,
   259                  Env: null,
   260                  Cmd: [
   261                  "/bin/bash",
   262                  "-c",
   263                  "apt-get -q -yy -f install libevent-dev"
   264                  ],
   265                  Dns: null,
   266                  Image: "imagename/blah",
   267                  Volumes: { },
   268                  VolumesFrom: ""
   269              },
   270              docker_version: "0.1.7"
   271          }
   272  
   273  Status Codes:
   274  
   275  - **200** – OK
   276  - **401** – Requires authorization
   277  - **404** – Image not found
   278  
   279  ## Ancestry
   280  
   281  ### Get image ancestry
   282  
   283  `GET /v1/images/(image_id)/ancestry`
   284  
   285  Get ancestry for an image given an `image_id`
   286  
   287  **Example Request**:
   288  
   289          GET /v1/images/088b4505aa3adc3d35e79c031fa126b403200f02f51920fbd9b7c503e87c7a2c/ancestry HTTP/1.1
   290          Host: registry-1.docker.io
   291          Accept: application/json
   292          Content-Type: application/json
   293          Cookie: (Cookie provided by the Registry)
   294  
   295  Parameters:
   296  
   297  - **image_id** – the id for the layer you want to get
   298  
   299  **Example Response**:
   300  
   301          HTTP/1.1 200
   302          Vary: Accept
   303          Content-Type: application/json
   304          X-Docker-Registry-Version: 0.6.0
   305  
   306          ["088b4502f51920fbd9b7c503e87c7a2c05aa3adc3d35e79c031fa126b403200f",
   307           "aeee63968d87c7da4a5cf5d2be6bee4e21bc226fd62273d180a49c96c62e4543",
   308           "bfa4c5326bc764280b0863b46a4b20d940bc1897ef9c1dfec060604bdc383280",
   309           "6ab5893c6927c15a15665191f2c6cf751f5056d8b95ceee32e43c5e8a3648544"]
   310  
   311  Status Codes:
   312  
   313  - **200** – OK
   314  - **401** – Requires authorization
   315  - **404** – Image not found
   316  
   317  ## Tags
   318  
   319  ### List repository tags
   320  
   321  `GET /v1/repositories/(namespace)/(repository)/tags`
   322  
   323  Get all of the tags for the given repo.
   324  
   325  **Example Request**:
   326  
   327          GET /v1/repositories/reynholm/help-system-server/tags HTTP/1.1
   328          Host: registry-1.docker.io
   329          Accept: application/json
   330          Content-Type: application/json
   331          X-Docker-Registry-Version: 0.6.0
   332          Cookie: (Cookie provided by the Registry)
   333  
   334  Parameters:
   335  
   336  - **namespace** – namespace for the repo
   337  - **repository** – name for the repo
   338  
   339  **Example Response**:
   340  
   341          HTTP/1.1 200
   342          Vary: Accept
   343          Content-Type: application/json
   344          X-Docker-Registry-Version: 0.6.0
   345  
   346          {
   347              "latest": "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f",
   348              "0.1.1":  "b486531f9a779a0c17e3ed29dae8f12c4f9e89cc6f0bc3c38722009fe6857087"
   349          }
   350  
   351  Status Codes:
   352  
   353  - **200** – OK
   354  - **401** – Requires authorization
   355  - **404** – Repository not found
   356  
   357  ### Get image id for a particular tag
   358  
   359  `GET /v1/repositories/(namespace)/(repository)/tags/(tag*)`
   360  
   361  Get a tag for the given repo.
   362  
   363  **Example Request**:
   364  
   365          GET /v1/repositories/reynholm/help-system-server/tags/latest HTTP/1.1
   366          Host: registry-1.docker.io
   367          Accept: application/json
   368          Content-Type: application/json
   369          X-Docker-Registry-Version: 0.6.0
   370          Cookie: (Cookie provided by the Registry)
   371  
   372  Parameters:
   373  
   374  - **namespace** – namespace for the repo
   375  - **repository** – name for the repo
   376  - **tag** – name of tag you want to get
   377  
   378  **Example Response**:
   379  
   380          HTTP/1.1 200
   381          Vary: Accept
   382          Content-Type: application/json
   383          X-Docker-Registry-Version: 0.6.0
   384  
   385          "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"
   386  
   387  Status Codes:
   388  
   389  - **200** – OK
   390  - **401** – Requires authorization
   391  - **404** – Tag not found
   392  
   393  ### Delete a repository tag
   394  
   395  `DELETE /v1/repositories/(namespace)/(repository)/tags/(tag*)`
   396  
   397  Delete the tag for the repo
   398  
   399  **Example Request**:
   400  
   401          DELETE /v1/repositories/reynholm/help-system-server/tags/latest HTTP/1.1
   402          Host: registry-1.docker.io
   403          Accept: application/json
   404          Content-Type: application/json
   405          Cookie: (Cookie provided by the Registry)
   406  
   407  Parameters:
   408  
   409  - **namespace** – namespace for the repo
   410  - **repository** – name for the repo
   411  - **tag** – name of tag you want to delete
   412  
   413  **Example Response**:
   414  
   415          HTTP/1.1 200
   416          Vary: Accept
   417          Content-Type: application/json
   418          X-Docker-Registry-Version: 0.6.0
   419  
   420          ""
   421  
   422  Status Codes:
   423  
   424  - **200** – OK
   425  - **401** – Requires authorization
   426  - **404** – Tag not found
   427  
   428  ### Set a tag for a specified image id
   429  
   430  `PUT /v1/repositories/(namespace)/(repository)/tags/(tag*)`
   431  
   432  Put a tag for the given repo.
   433  
   434  **Example Request**:
   435  
   436          PUT /v1/repositories/reynholm/help-system-server/tags/latest HTTP/1.1
   437          Host: registry-1.docker.io
   438          Accept: application/json
   439          Content-Type: application/json
   440          Cookie: (Cookie provided by the Registry)
   441  
   442          "9e89cc6f0bc3c38722009fe6857087b486531f9a779a0c17e3ed29dae8f12c4f"
   443  
   444  Parameters:
   445  
   446  - **namespace** – namespace for the repo
   447  - **repository** – name for the repo
   448  - **tag** – name of tag you want to add
   449  
   450  **Example Response**:
   451  
   452          HTTP/1.1 200
   453          Vary: Accept
   454          Content-Type: application/json
   455          X-Docker-Registry-Version: 0.6.0
   456  
   457          ""
   458  
   459  Status Codes:
   460  
   461  - **200** – OK
   462  - **400** – Invalid data
   463  - **401** – Requires authorization
   464  - **404** – Image not found
   465  
   466  ## Repositories
   467  
   468  ### Delete a repository
   469  
   470  `DELETE /v1/repositories/(namespace)/(repository)/`
   471  
   472  Delete a repository
   473  
   474  **Example Request**:
   475  
   476          DELETE /v1/repositories/reynholm/help-system-server/ HTTP/1.1
   477          Host: registry-1.docker.io
   478          Accept: application/json
   479          Content-Type: application/json
   480          Cookie: (Cookie provided by the Registry)
   481  
   482          ""
   483  
   484  Parameters:
   485  
   486  - **namespace** – namespace for the repo
   487  - **repository** – name for the repo
   488  
   489  **Example Response**:
   490  
   491          HTTP/1.1 200
   492          Vary: Accept
   493          Content-Type: application/json
   494          X-Docker-Registry-Version: 0.6.0
   495  
   496          ""
   497  
   498  Status Codes:
   499  
   500  - **200** – OK
   501  - **401** – Requires authorization
   502  - **404** – Repository not found
   503  
   504  ## Search
   505  
   506  If you need to search the index, this is the endpoint you would use.
   507  
   508  `GET /v1/search`
   509  
   510  Search the Index given a search term. It accepts
   511  
   512      [GET](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3)
   513      only.
   514  
   515  **Example request**:
   516  
   517          GET /v1/search?q=search_term&page=1&n=25 HTTP/1.1
   518          Host: index.docker.io
   519          Accept: application/json
   520  
   521  Query Parameters:
   522  
   523  - **q** – what you want to search for
   524  - **n** - number of results you want returned per page (default: 25, min:1, max:100)
   525  - **page** - page number of results
   526  
   527  **Example response**:
   528  
   529          HTTP/1.1 200 OK
   530          Vary: Accept
   531          Content-Type: application/json
   532  
   533          {"num_pages": 1,
   534            "num_results": 3,
   535            "results" : [
   536               {"name": "ubuntu", "description": "An ubuntu image..."},
   537               {"name": "centos", "description": "A centos image..."},
   538               {"name": "fedora", "description": "A fedora image..."}
   539             ],
   540            "page_size": 25,
   541            "query":"search_term",
   542            "page": 1
   543           }
   544  
   545  Response Items:
   546  - **num_pages** - Total number of pages returned by query
   547  - **num_results** - Total number of results returned by query
   548  - **results** - List of results for the current page
   549  - **page_size** - How many results returned per page
   550  - **query** - Your search term
   551  - **page** - Current page number
   552  
   553  Status Codes:
   554  
   555  - **200** – no error
   556  - **500** – server error
   557  
   558  ## Status
   559  
   560  ### Status check for registry
   561  
   562  `GET /v1/_ping`
   563  
   564  Check status of the registry. This endpoint is also used to
   565  determine if the registry supports SSL.
   566  
   567  **Example Request**:
   568  
   569          GET /v1/_ping HTTP/1.1
   570          Host: registry-1.docker.io
   571          Accept: application/json
   572          Content-Type: application/json
   573  
   574          ""
   575  
   576  **Example Response**:
   577  
   578          HTTP/1.1 200
   579          Vary: Accept
   580          Content-Type: application/json
   581          X-Docker-Registry-Version: 0.6.0
   582  
   583          ""
   584  
   585  Status Codes:
   586  
   587  - **200** – OK
   588  
   589  ## Authorization
   590  
   591  This is where we describe the authorization process, including the
   592  tokens and cookies.
   593