github.com/codemac/docker@v1.2.1-0.20150518222241-6a18412d5b9c/docs/sources/reference/api/docker_remote_api.md (about)

     1  page_title: Remote API
     2  page_description: API Documentation for Docker
     3  page_keywords: API, Docker, rcli, REST, documentation
     4  
     5  # Docker Remote API
     6  
     7   - By default the Docker daemon listens on `unix:///var/run/docker.sock`
     8     and the client must have `root` access to interact with the daemon.
     9   - If the Docker daemon is set to use an encrypted TCP socket (`--tls`,
    10     or `--tlsverify`) as with Boot2Docker 1.3.0, then you need to add extra
    11     parameters to `curl` or `wget` when making test API requests:
    12     `curl --insecure --cert ~/.docker/cert.pem --key ~/.docker/key.pem https://boot2docker:2376/images/json`
    13     or 
    14     `wget --no-check-certificate --certificate=$DOCKER_CERT_PATH/cert.pem --private-key=$DOCKER_CERT_PATH/key.pem https://boot2docker:2376/images/json -O - -q`
    15   - If a group named `docker` exists on your system, docker will apply
    16     ownership of the socket to the group.
    17   - The API tends to be REST, but for some complex commands, like attach
    18     or pull, the HTTP connection is hijacked to transport STDOUT, STDIN,
    19     and STDERR.
    20   - Since API version 1.2, the auth configuration is now handled client
    21     side, so the client has to send the `authConfig` as a `POST` in `/images/(name)/push`.
    22   - authConfig, set as the `X-Registry-Auth` header, is currently a Base64
    23     encoded (JSON) string with the following structure:
    24     `{"username": "string", "password": "string", "email": "string",
    25     "serveraddress" : "string", "auth": ""}`. Notice that `auth` is to be left
    26     empty, `serveraddress` is a domain/ip without protocol, and that double
    27     quotes (instead of single ones) are required.
    28   - The Remote API uses an open schema model.  In this model, unknown 
    29     properties in incoming messages will be ignored.
    30     Client applications need to take this into account to ensure
    31     they will not break when talking to newer Docker daemons.
    32  
    33  The current version of the API is v1.19
    34  
    35  Calling `/info` is the same as calling
    36  `/v1.19/info`.
    37  
    38  You can still call an old version of the API using
    39  `/v1.18/info`.
    40  
    41  ## v1.19
    42  
    43  ### Full documentation
    44  
    45  [*Docker Remote API v1.19*](/reference/api/docker_remote_api_v1.19/)
    46  
    47  ### What's new
    48  
    49  `GET /containers/(id)/stats`
    50  
    51  **New!**
    52  You can now supply a `stream` bool to get only one set of stats and
    53  disconnect
    54  
    55  `GET /containers(id)/logs`
    56  
    57  **New!**
    58  
    59  This endpoint now accepts a `since` timestamp parameter.
    60  
    61  `GET /info`
    62  
    63  **New!**
    64  
    65  The fields `Debug`, `IPv4Forwarding`, `MemoryLimit`, and `SwapLimit`
    66  are now returned as boolean instead of as an int.
    67  
    68  In addition, the end point now returns the new boolean fields
    69  `CpuCfsPeriod`, `CpuCfsQuota`, and `OomKillDisable`.
    70  
    71  ## v1.18
    72  
    73  ### Full documentation
    74  
    75  [*Docker Remote API v1.18*](/reference/api/docker_remote_api_v1.18/)
    76  
    77  ### What's new
    78  
    79  `GET /version`
    80  
    81  **New!**
    82  This endpoint now returns `Os`, `Arch` and `KernelVersion`.
    83  
    84  `POST /containers/create`
    85  `POST /containers/(id)/start`
    86  
    87  **New!**
    88  You can set ulimit settings to be used within the container.
    89  
    90  `GET /info`
    91  
    92  **New!**
    93  This endpoint now returns `SystemTime`, `HttpProxy`,`HttpsProxy` and `NoProxy`.
    94  
    95  `GET /images/json`
    96  
    97  **New!**
    98  Added a `RepoDigests` field to include image digest information.
    99  
   100  `POST /build`
   101  
   102  **New!**
   103  Builds can now set resource constraints for all containers created for the build.
   104  
   105  **New!**
   106  (`CgroupParent`) can be passed in the host config to setup container cgroups under a specific cgroup.
   107  
   108  `POST /build`
   109  
   110  **New!**
   111  Closing the HTTP request will now cause the build to be canceled.
   112  
   113  `POST /containers/(id)/exec`
   114  
   115  **New!**
   116  Add `Warnings` field to response.
   117  
   118  ## v1.17
   119  
   120  ### Full documentation
   121  
   122  [*Docker Remote API v1.17*](/reference/api/docker_remote_api_v1.17/)
   123  
   124  ### What's new
   125  
   126  The build supports `LABEL` command. Use this to add metadata
   127  to an image. For example you could add data describing the content of an image.
   128  
   129  `LABEL "com.example.vendor"="ACME Incorporated"`
   130  
   131  **New!**
   132  `POST /containers/(id)/attach` and `POST /exec/(id)/start`
   133  
   134  **New!**
   135  Docker client now hints potential proxies about connection hijacking using HTTP Upgrade headers.
   136  
   137  `POST /containers/create`
   138  
   139  **New!**
   140  You can set labels on container create describing the container.
   141  
   142  `GET /containers/json`
   143  
   144  **New!**
   145  The endpoint returns the labels associated with the containers (`Labels`).
   146  
   147  `GET /containers/(id)/json`
   148  
   149  **New!**
   150  This endpoint now returns the list current execs associated with the container (`ExecIDs`).
   151  This endpoint now returns the container labels (`Config.Labels`).
   152  
   153  `POST /containers/(id)/rename`
   154  
   155  **New!**
   156  New endpoint to rename a container `id` to a new name.
   157  
   158  `POST /containers/create`
   159  `POST /containers/(id)/start`
   160  
   161  **New!**
   162  (`ReadonlyRootfs`) can be passed in the host config to mount the container's
   163  root filesystem as read only.
   164  
   165  `GET /containers/(id)/stats`
   166  
   167  **New!**
   168  This endpoint returns a live stream of a container's resource usage statistics.
   169  
   170  `GET /images/json`
   171  
   172  **New!**
   173  This endpoint now returns the labels associated with each image (`Labels`).
   174  
   175  
   176  ## v1.16
   177  
   178  ### Full documentation
   179  
   180  [*Docker Remote API v1.16*](/reference/api/docker_remote_api_v1.16/)
   181  
   182  ### What's new
   183  
   184  `GET /info`
   185  
   186  **New!**
   187  `info` now returns the number of CPUs available on the machine (`NCPU`),
   188  total memory available (`MemTotal`), a user-friendly name describing the running Docker daemon (`Name`), a unique ID identifying the daemon (`ID`), and
   189  a list of daemon labels (`Labels`).
   190  
   191  `POST /containers/create`
   192  
   193  **New!**
   194  You can set the new container's MAC address explicitly.
   195  
   196  **New!**
   197  Volumes are now initialized when the container is created.
   198  
   199  `POST /containers/(id)/copy`
   200  
   201  **New!**
   202  You can now copy data which is contained in a volume.
   203  
   204  ## v1.15
   205  
   206  ### Full documentation
   207  
   208  [*Docker Remote API v1.15*](/reference/api/docker_remote_api_v1.15/)
   209  
   210  ### What's new
   211  
   212  `POST /containers/create`
   213  
   214  **New!**
   215  It is now possible to set a container's HostConfig when creating a container.
   216  Previously this was only available when starting a container.
   217  
   218  ## v1.14
   219  
   220  ### Full documentation
   221  
   222  [*Docker Remote API v1.14*](/reference/api/docker_remote_api_v1.14/)
   223  
   224  ### What's new
   225  
   226  `DELETE /containers/(id)`
   227  
   228  **New!**
   229  When using `force`, the container will be immediately killed with SIGKILL.
   230  
   231  `POST /containers/(id)/start`
   232  
   233  **New!**
   234  The `hostConfig` option now accepts the field `CapAdd`, which specifies a list of capabilities
   235  to add, and the field `CapDrop`, which specifies a list of capabilities to drop.
   236  
   237  `POST /images/create`
   238  
   239  **New!**
   240  The `fromImage` and `repo` parameters now supports the `repo:tag` format.
   241  Consequently,  the `tag` parameter is now obsolete. Using the new format and
   242  the `tag` parameter at the same time will return an error.
   243  
   244  ## v1.13
   245  
   246  ### Full documentation
   247  
   248  [*Docker Remote API v1.13*](/reference/api/docker_remote_api_v1.13/)
   249  
   250  ### What's new
   251  
   252  `GET /containers/(name)/json`
   253  
   254  **New!**
   255  The `HostConfig.Links` field is now filled correctly
   256  
   257  **New!**
   258  `Sockets` parameter added to the `/info` endpoint listing all the sockets the 
   259  daemon is configured to listen on.
   260  
   261  `POST /containers/(name)/start`
   262  `POST /containers/(name)/stop`
   263  
   264  **New!**
   265  `start` and `stop` will now return 304 if the container's status is not modified
   266  
   267  `POST /commit`
   268  
   269  **New!**
   270  Added a `pause` parameter (default `true`) to pause the container during commit
   271  
   272  ## v1.12
   273  
   274  ### Full documentation
   275  
   276  [*Docker Remote API v1.12*](/reference/api/docker_remote_api_v1.12/)
   277  
   278  ### What's new
   279  
   280  `POST /build`
   281  
   282  **New!**
   283  Build now has support for the `forcerm` parameter to always remove containers
   284  
   285  `GET /containers/(name)/json`
   286  `GET /images/(name)/json`
   287  
   288  **New!**
   289  All the JSON keys are now in CamelCase
   290  
   291  **New!**
   292  Trusted builds are now Automated Builds - `is_trusted` is now `is_automated`.
   293  
   294  **Removed Insert Endpoint**
   295  The `insert` endpoint has been removed.
   296  
   297  ## v1.11
   298  
   299  ### Full documentation
   300  
   301  [*Docker Remote API v1.11*](/reference/api/docker_remote_api_v1.11/)
   302  
   303  ### What's new
   304  
   305  `GET /_ping`
   306  
   307  **New!**
   308  You can now ping the server via the `_ping` endpoint.
   309  
   310  `GET /events`
   311  
   312  **New!**
   313  You can now use the `-until` parameter to close connection
   314  after timestamp.
   315  
   316  `GET /containers/(id)/logs`
   317  
   318  This url is preferred method for getting container logs now.
   319  
   320  ## v1.10
   321  
   322  ### Full documentation
   323  
   324  [*Docker Remote API v1.10*](/reference/api/docker_remote_api_v1.10/)
   325  
   326  ### What's new
   327  
   328  `DELETE /images/(name)`
   329  
   330  **New!**
   331  You can now use the force parameter to force delete of an
   332      image, even if it's tagged in multiple repositories. **New!**
   333      You
   334      can now use the noprune parameter to prevent the deletion of parent
   335      images
   336  
   337  `DELETE /containers/(id)`
   338  
   339  **New!**
   340  You can now use the force parameter to force delete a
   341      container, even if it is currently running
   342  
   343  ## v1.9
   344  
   345  ### Full documentation
   346  
   347  [*Docker Remote API v1.9*](/reference/api/docker_remote_api_v1.9/)
   348  
   349  ### What's new
   350  
   351  `POST /build`
   352  
   353  **New!**
   354  This endpoint now takes a serialized ConfigFile which it
   355  uses to resolve the proper registry auth credentials for pulling the
   356  base image. Clients which previously implemented the version
   357  accepting an AuthConfig object must be updated.
   358  
   359  ## v1.8
   360  
   361  ### Full documentation
   362  
   363  [*Docker Remote API v1.8*](/reference/api/docker_remote_api_v1.8/)
   364  
   365  ### What's new
   366  
   367  `POST /build`
   368  
   369  **New!**
   370  This endpoint now returns build status as json stream. In
   371  case of a build error, it returns the exit status of the failed
   372  command.
   373  
   374  `GET /containers/(id)/json`
   375  
   376  **New!**
   377  This endpoint now returns the host config for the
   378  container.
   379  
   380  `POST /images/create`
   381  
   382  `POST /images/(name)/insert`
   383  
   384  `POST /images/(name)/push`
   385  
   386  **New!**
   387  progressDetail object was added in the JSON. It's now
   388  possible to get the current value and the total of the progress
   389  without having to parse the string.
   390  
   391  ## v1.7
   392  
   393  ### Full documentation
   394  
   395  [*Docker Remote API v1.7*](/reference/api/docker_remote_api_v1.7/)
   396  
   397  ### What's new
   398  
   399  `GET /images/json`
   400  
   401  The format of the json returned from this uri changed. Instead of an
   402  entry for each repo/tag on an image, each image is only represented
   403  once, with a nested attribute indicating the repo/tags that apply to
   404  that image.
   405  
   406  Instead of:
   407  
   408      HTTP/1.1 200 OK
   409      Content-Type: application/json
   410  
   411      [
   412        {
   413          "VirtualSize": 131506275,
   414          "Size": 131506275,
   415          "Created": 1365714795,
   416          "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
   417          "Tag": "12.04",
   418          "Repository": "ubuntu"
   419        },
   420        {
   421          "VirtualSize": 131506275,
   422          "Size": 131506275,
   423          "Created": 1365714795,
   424          "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
   425          "Tag": "latest",
   426          "Repository": "ubuntu"
   427        },
   428        {
   429          "VirtualSize": 131506275,
   430          "Size": 131506275,
   431          "Created": 1365714795,
   432          "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
   433          "Tag": "precise",
   434          "Repository": "ubuntu"
   435        },
   436        {
   437          "VirtualSize": 180116135,
   438          "Size": 24653,
   439          "Created": 1364102658,
   440          "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
   441          "Tag": "12.10",
   442          "Repository": "ubuntu"
   443        },
   444        {
   445          "VirtualSize": 180116135,
   446          "Size": 24653,
   447          "Created": 1364102658,
   448          "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
   449          "Tag": "quantal",
   450          "Repository": "ubuntu"
   451        }
   452      ]
   453  
   454  The returned json looks like this:
   455  
   456      HTTP/1.1 200 OK
   457      Content-Type: application/json
   458  
   459      [
   460        {
   461           "RepoTags": [
   462             "ubuntu:12.04",
   463             "ubuntu:precise",
   464             "ubuntu:latest"
   465           ],
   466           "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
   467           "Created": 1365714795,
   468           "Size": 131506275,
   469           "VirtualSize": 131506275
   470        },
   471        {
   472           "RepoTags": [
   473             "ubuntu:12.10",
   474             "ubuntu:quantal"
   475           ],
   476           "ParentId": "27cf784147099545",
   477           "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
   478           "Created": 1364102658,
   479           "Size": 24653,
   480           "VirtualSize": 180116135
   481        }
   482      ]
   483  
   484  `GET /images/viz`
   485  
   486  This URI no longer exists. The `images --viz`
   487  output is now generated in the client, using the
   488  `/images/json` data.
   489  
   490  ## v1.6
   491  
   492  ### Full documentation
   493  
   494  [*Docker Remote API v1.6*](/reference/api/docker_remote_api_v1.6/)
   495  
   496  ### What's new
   497  
   498  `POST /containers/(id)/attach`
   499  
   500  **New!**
   501  You can now split stderr from stdout. This is done by
   502  prefixing a header to each transmission. See
   503  [`POST /containers/(id)/attach`](
   504  /reference/api/docker_remote_api_v1.9/#attach-to-a-container "POST /containers/(id)/attach").
   505  The WebSocket attach is unchanged. Note that attach calls on the
   506  previous API version didn't change. Stdout and stderr are merged.
   507  
   508  ## v1.5
   509  
   510  ### Full documentation
   511  
   512  [*Docker Remote API v1.5*](/reference/api/docker_remote_api_v1.5/)
   513  
   514  ### What's new
   515  
   516  `POST /images/create`
   517  
   518  **New!**
   519  You can now pass registry credentials (via an AuthConfig
   520      object) through the X-Registry-Auth header
   521  
   522  `POST /images/(name)/push`
   523  
   524  **New!**
   525  The AuthConfig object now needs to be passed through the
   526      X-Registry-Auth header
   527  
   528  `GET /containers/json`
   529  
   530  **New!**
   531  The format of the Ports entry has been changed to a list of
   532  dicts each containing PublicPort, PrivatePort and Type describing a
   533  port mapping.
   534  
   535  ## v1.4
   536  
   537  ### Full documentation
   538  
   539  [*Docker Remote API v1.4*](/reference/api/docker_remote_api_v1.4/)
   540  
   541  ### What's new
   542  
   543  `POST /images/create`
   544  
   545  **New!**
   546  When pulling a repo, all images are now downloaded in parallel.
   547  
   548  `GET /containers/(id)/top`
   549  
   550  **New!**
   551  You can now use ps args with docker top, like docker top
   552      <container_id> aux
   553  
   554  `GET /events`
   555  
   556  **New!**
   557  Image's name added in the events
   558  
   559  ## v1.3
   560  
   561  docker v0.5.0
   562  [51f6c4a](https://github.com/docker/docker/commit/51f6c4a7372450d164c61e0054daf0223ddbd909)
   563  
   564  ### Full documentation
   565  
   566  [*Docker Remote API v1.3*](/reference/api/docker_remote_api_v1.3/)
   567  
   568  ### What's new
   569  
   570  `GET /containers/(id)/top`
   571  
   572  List the processes running inside a container.
   573  
   574  `GET /events`
   575  
   576  **New!**
   577  Monitor docker's events via streaming or via polling
   578  
   579  Builder (/build):
   580  
   581   - Simplify the upload of the build context
   582   - Simply stream a tarball instead of multipart upload with 4
   583     intermediary buffers
   584   - Simpler, less memory usage, less disk usage and faster
   585  
   586  > **Warning**: 
   587  > The /build improvements are not reverse-compatible. Pre 1.3 clients will
   588  > break on /build.
   589  
   590  List containers (/containers/json):
   591  
   592   - You can use size=1 to get the size of the containers
   593  
   594  Start containers (/containers/<id>/start):
   595  
   596   - You can now pass host-specific configuration (e.g., bind mounts) in
   597     the POST body for start calls
   598  
   599  ## v1.2
   600  
   601  docker v0.4.2
   602  [2e7649b](https://github.com/docker/docker/commit/2e7649beda7c820793bd46766cbc2cfeace7b168)
   603  
   604  ### Full documentation
   605  
   606  [*Docker Remote API v1.2*](/reference/api/docker_remote_api_v1.2/)
   607  
   608  ### What's new
   609  
   610  The auth configuration is now handled by the client.
   611  
   612  The client should send it's authConfig as POST on each call of
   613  `/images/(name)/push`
   614  
   615  `GET /auth`
   616  
   617  **Deprecated.**
   618  
   619  `POST /auth`
   620  
   621  Only checks the configuration but doesn't store it on the server
   622  
   623      Deleting an image is now improved, will only untag the image if it
   624      has children and remove all the untagged parents if has any.
   625  
   626  `POST /images/<name>/delete`
   627  
   628  Now returns a JSON structure with the list of images
   629  deleted/untagged.
   630  
   631  ## v1.1
   632  
   633  docker v0.4.0
   634  [a8ae398](https://github.com/docker/docker/commit/a8ae398bf52e97148ee7bd0d5868de2e15bd297f)
   635  
   636  ### Full documentation
   637  
   638  [*Docker Remote API v1.1*](/reference/api/docker_remote_api_v1.1/)
   639  
   640  ### What's new
   641  
   642  `POST /images/create`
   643  
   644  `POST /images/(name)/insert`
   645  
   646  `POST /images/(name)/push`
   647  
   648  Uses json stream instead of HTML hijack, it looks like this:
   649  
   650          HTTP/1.1 200 OK
   651          Content-Type: application/json
   652  
   653          {"status":"Pushing..."}
   654          {"status":"Pushing", "progress":"1/? (n/a)"}
   655          {"error":"Invalid..."}
   656          ...
   657  
   658  ## v1.0
   659  
   660  docker v0.3.4
   661  [8d73740](https://github.com/docker/docker/commit/8d73740343778651c09160cde9661f5f387b36f4)
   662  
   663  ### Full documentation
   664  
   665  [*Docker Remote API v1.0*](/reference/api/docker_remote_api_v1.0/)
   666  
   667  ### What's new
   668  
   669  Initial version