github.com/robertojrojas/docker@v1.9.1/docs/reference/api/docker_remote_api.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Remote API"
     4  description = "API Documentation for Docker"
     5  keywords = ["API, Docker, rcli, REST,  documentation"]
     6  [menu.main]
     7  parent = "smn_remoteapi"
     8  weight=-3
     9  +++
    10  <![end-metadata]-->
    11  
    12  # Docker Remote API
    13  
    14  Docker's Remote API uses an open schema model.  In this model, unknown
    15  properties in incoming messages are ignored. Client applications need to take
    16  this behavior into account to ensure they do not break when talking to newer
    17  Docker daemons.
    18  
    19  The API tends to be REST, but for some complex commands, like attach or pull,
    20  the HTTP connection is hijacked to transport STDOUT, STDIN, and STDERR.
    21  
    22  By default the Docker daemon listens on `unix:///var/run/docker.sock` and the
    23  client must have `root` access to interact with the daemon. If a group named
    24  `docker` exists on your system, `docker` applies ownership of the socket to the
    25  group.
    26  
    27  The current version of the API is v1.21 which means calling `/info` is the same
    28  as calling `/v1.21/info`. To call an older version of the API use
    29  `/v1.20/info`.
    30  
    31  Use the table below to find the API version for a Docker version:
    32  
    33  Docker version  | API version                                     | Changes
    34  ----------------|-------------------------------------------------|-----------------------------
    35  1.9.x           | [1.21](docker_remote_api_v1.21.md) | [API changes](docker_remote_api.md#v1-21-api-changes)
    36  1.8.x           | [1.20](docker_remote_api_v1.20.md) | [API changes](docker_remote_api.md#v1-20-api-changes)
    37  1.7.x           | [1.19](docker_remote_api_v1.19.md) | [API changes](docker_remote_api.md#v1-19-api-changes)
    38  1.6.x           | [1.18](docker_remote_api_v1.18.md) | [API changes](docker_remote_api.md#v1-18-api-changes)
    39  1.5.x           | [1.17](docker_remote_api_v1.17.md) | [API changes](docker_remote_api.md#v1-17-api-changes)
    40  1.4.x           | [1.16](docker_remote_api_v1.16.md) | [API changes](docker_remote_api.md#v1-16-api-changes)
    41  1.3.x           | [1.15](docker_remote_api_v1.15.md) | [API changes](docker_remote_api.md#v1-15-api-changes)
    42  1.2.x           | [1.14](docker_remote_api_v1.14.md) | [API changes](docker_remote_api.md#v1-14-api-changes)
    43  
    44  Refer to the [GitHub repository](
    45  https://github.com/docker/docker/tree/master/docs/reference/api) for
    46  older releases.
    47  
    48  ## Authentication
    49  
    50  Since API version 1.2, the auth configuration is now handled client side, so the
    51  client has to send the `authConfig` as a `POST` in `/images/(name)/push`. The
    52  `authConfig`, set as the `X-Registry-Auth` header, is currently a Base64 encoded
    53  (JSON) string with the following structure:
    54  
    55  ```
    56  {"username": "string", "password": "string", "email": "string",
    57     "serveraddress" : "string", "auth": ""}
    58  ```
    59  
    60  Callers should leave the `auth` empty. The `serveraddress` is a domain/ip
    61  without protocol. Throughout this structure, double quotes are required.
    62  
    63  ## Using Docker Machine with the API
    64  
    65  If you are using `docker-machine`, the Docker daemon is on a virtual host that uses an encrypted TCP socket. This means, for Docker Machine users, you need to add extra parameters to `curl` or `wget` when making test API requests, for example:
    66  
    67  ```
    68  curl --insecure --cert ~/.docker/cert.pem --key ~/.docker/key.pem https://YOUR_VM_IP:2376/images/json
    69  
    70  wget --no-check-certificate --certificate=$DOCKER_CERT_PATH/cert.pem --private-key=$DOCKER_CERT_PATH/key.pem https://your_vm_ip:2376/images/json -O - -q
    71  ```
    72  
    73  ## Docker Events
    74  
    75  The following diagram depicts the container states accessible through the API.
    76  
    77  ![States](images/event_state.png)
    78  
    79  Some container-related events are not affected by container state, so they are not included in this diagram. These events are:
    80  
    81  * **export** emitted by `docker export`
    82  * **exec_create** emitted by `docker exec`
    83  * **exec_start** emitted by `docker exec` after **exec_create**
    84  
    85  Running `docker rmi` emits an **untag** event when removing an image name.  The `rmi` command may also emit **delete** events when images are deleted by ID directly or by deleting the last tag referring to the image.
    86  
    87  > **Acknowledgement**: This diagram and the accompanying text were used with the permission of Matt Good and Gilder Labs. See Matt's original blog post [Docker Events Explained](http://gliderlabs.com/blog/2015/04/14/docker-events-explained/).
    88  
    89  ## Version history
    90  
    91  This section lists each version from latest to oldest.  Each listing includes a link to the full documentation set and the changes relevant in that release.
    92  
    93  ### v1.21 API changes
    94  
    95  [Docker Remote API v1.21](docker_remote_api_v1.21.md) documentation
    96  
    97  * `GET /volumes` lists volumes from all volume drivers.
    98  * `POST /volumes/create` to create a volume.
    99  * `GET /volumes/(name)` get low-level information about a volume.
   100  * `DELETE /volumes/(name)`remove a volume with the specified name.
   101  * `VolumeDriver` has been moved from config to hostConfig to make the configuration portable.
   102  * `GET /images/(name)/json` now returns information about tags and digests of the image.
   103  * The `config` option now accepts the field `StopSignal`, which specifies the signal to use to kill a container.
   104  * `GET /containers/(id)/stats` will return networking information respectively for each interface.
   105  * The `hostConfig` option now accepts the field `DnsOptions`, which specifies a
   106  list of DNS options to be used in the container.
   107  * `POST /build` now optionally takes a serialized map of build-time variables.
   108  * `GET /events` now includes a `timenano` field, in addition to the existing `time` field.
   109  * `GET /events` now supports filtering by image and container labels.
   110  * `GET /info` now lists engine version information.
   111  * `GET /containers/json` will return `ImageID` of the image used by container.
   112  * `POST /exec/(name)/start` will now return an HTTP 409 when the container is either stopped or paused.
   113  * `GET /containers/(name)/json` now accepts a `size` parameter. Setting this parameter to '1' returns container size information in the `SizeRw` and `SizeRootFs` fields.
   114  * `GET /containers/(name)/json` now returns a `NetworkSettings.Networks` field,
   115    detailing network settings per network. This field deprecates the
   116    `NetworkSettings.Gateway`, `NetworkSettings.IPAddress`,
   117    `NetworkSettings.IPPrefixLen`, and `NetworkSettings.MacAddress` fields, which
   118    are still returned for backward-compatibility, but will be removed in a future version.
   119  * `GET /exec/(id)/json` now returns a `NetworkSettings.Networks` field,
   120    detailing networksettings per network. This field deprecates the
   121    `NetworkSettings.Gateway`, `NetworkSettings.IPAddress`,
   122    `NetworkSettings.IPPrefixLen`, and `NetworkSettings.MacAddress` fields, which
   123    are still returned for backward-compatibility, but will be removed in a future version.
   124  
   125  ### v1.20 API changes
   126  
   127  [Docker Remote API v1.20](docker_remote_api_v1.20.md) documentation
   128  
   129  * `GET /containers/(id)/archive` get an archive of filesystem content from a container.
   130  * `PUT /containers/(id)/archive` upload an archive of content to be extracted to
   131  an existing directory inside a container's filesystem.
   132  * `POST /containers/(id)/copy` is deprecated in favor of the above `archive`
   133  endpoint which can be used to download files and directories from a container.
   134  * The `hostConfig` option now accepts the field `GroupAdd`, which specifies a
   135  list of additional groups that the container process will run as.
   136  
   137  ### v1.19 API changes
   138  
   139  [Docker Remote API v1.19](docker_remote_api_v1.19.md) documentation
   140  
   141  * When the daemon detects a version mismatch with the client, usually when
   142  the client is newer than the daemon, an HTTP 400 is now returned instead
   143  of a 404.
   144  * `GET /containers/(id)/stats` now accepts `stream` bool to get only one set of stats and disconnect.
   145  * `GET /containers/(id)/logs` now accepts a `since` timestamp parameter.
   146  * `GET /info` The fields `Debug`, `IPv4Forwarding`, `MemoryLimit`, and
   147  `SwapLimit` are now returned as boolean instead of as an int. In addition, the
   148  end point now returns the new boolean fields `CpuCfsPeriod`, `CpuCfsQuota`, and
   149  `OomKillDisable`.
   150  * The `hostConfig` option now accepts the fields `CpuPeriod` and `CpuQuota`
   151  * `POST /build` accepts `cpuperiod` and `cpuquota` options
   152  
   153  ### v1.18 API changes
   154  
   155  [Docker Remote API v1.18](docker_remote_api_v1.18.md) documentation
   156  
   157  * `GET /version` now returns `Os`, `Arch` and `KernelVersion`.
   158  * `POST /containers/create` and `POST /containers/(id)/start`allow you to  set ulimit settings for use in the container.
   159  * `GET /info` now returns `SystemTime`, `HttpProxy`,`HttpsProxy` and `NoProxy`.
   160  * `GET /images/json` added a `RepoDigests` field to include image digest information.
   161  * `POST /build` can now set resource constraints for all containers created for the build.
   162  * `CgroupParent` can be passed in the host config to setup container cgroups under a specific cgroup.
   163  * `POST /build` closing the HTTP request cancels the build
   164  * `POST /containers/(id)/exec` includes `Warnings` field to response.
   165  
   166  ### v1.17 API changes
   167  
   168  [Docker Remote API v1.17](docker_remote_api_v1.17.md) documentation
   169  
   170  * The build supports `LABEL` command. Use this to add metadata to an image. For
   171  example you could add data describing the content of an image. `LABEL
   172  "com.example.vendor"="ACME Incorporated"`
   173  * `POST /containers/(id)/attach` and `POST /exec/(id)/start`
   174  * The Docker client now hints potential proxies about connection hijacking using HTTP Upgrade headers.
   175  * `POST /containers/create` sets labels on container create describing the container.
   176  * `GET /containers/json` returns the labels associated with the containers (`Labels`).
   177  * `GET /containers/(id)/json` returns the list current execs associated with the
   178  container (`ExecIDs`). This endpoint now returns the container labels
   179  (`Config.Labels`).
   180  * `POST /containers/(id)/rename` renames a container `id` to a new name.*
   181  * `POST /containers/create` and `POST /containers/(id)/start` callers can pass
   182  `ReadonlyRootfs` in the host config to mount the container's root filesystem as
   183  read only.
   184  * `GET /containers/(id)/stats` returns a live stream of a container's resource usage statistics.
   185  * `GET /images/json` returns the labels associated with each image (`Labels`).
   186  
   187  
   188  ### v1.16 API changes
   189  
   190  [Docker Remote API v1.16](docker_remote_api_v1.16.md)
   191  
   192  * `GET /info` returns the number of CPUs available on the machine (`NCPU`),
   193  total memory available (`MemTotal`), a user-friendly name describing the running Docker daemon (`Name`), a unique ID identifying the daemon (`ID`), and
   194  a list of daemon labels (`Labels`).
   195  * `POST /containers/create` callers can set the new container's MAC address explicitly.
   196  * Volumes are now initialized when the container is created.
   197  * `POST /containers/(id)/copy` copies data which is contained in a volume.
   198  
   199  ### v1.15 API changes
   200  
   201  [Docker Remote API v1.15](docker_remote_api_v1.15.md) documentation
   202  
   203  `POST /containers/create` you can set a container's `HostConfig` when creating a
   204  container. Previously this was only available when starting a container.
   205  
   206  ### v1.14 API changes
   207  
   208  [Docker Remote API v1.14](docker_remote_api_v1.14.md) documentation
   209  
   210  * `DELETE /containers/(id)` when using `force`, the container will be immediately killed with SIGKILL.
   211  * `POST /containers/(id)/start` the `hostConfig` option accepts the field `CapAdd`, which specifies a list of capabilities
   212  to add, and the field `CapDrop`, which specifies a list of capabilities to drop.
   213  * `POST /images/create` th `fromImage` and `repo` parameters supportthe
   214  `repo:tag` format. Consequently,  the `tag` parameter is now obsolete. Using the
   215  new format and the `tag` parameter at the same time will return an error.