github.com/nf/docker@v1.8.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 +++ 9 <![end-metadata]--> 10 11 # Docker Remote API 12 13 - By default the Docker daemon listens on `unix:///var/run/docker.sock` 14 and the client must have `root` access to interact with the daemon. 15 - If the Docker daemon is set to use an encrypted TCP socket (`--tls`, 16 or `--tlsverify`) as with Boot2Docker 1.3.0, then you need to add extra 17 parameters to `curl` or `wget` when making test API requests: 18 `curl --insecure --cert ~/.docker/cert.pem --key ~/.docker/key.pem https://boot2docker:2376/images/json` 19 or 20 `wget --no-check-certificate --certificate=$DOCKER_CERT_PATH/cert.pem --private-key=$DOCKER_CERT_PATH/key.pem https://boot2docker:2376/images/json -O - -q` 21 - If a group named `docker` exists on your system, docker will apply 22 ownership of the socket to the group. 23 - The API tends to be REST, but for some complex commands, like attach 24 or pull, the HTTP connection is hijacked to transport STDOUT, STDIN, 25 and STDERR. 26 - Since API version 1.2, the auth configuration is now handled client 27 side, so the client has to send the `authConfig` as a `POST` in `/images/(name)/push`. 28 - authConfig, set as the `X-Registry-Auth` header, is currently a Base64 29 encoded (JSON) string with the following structure: 30 `{"username": "string", "password": "string", "email": "string", 31 "serveraddress" : "string", "auth": ""}`. Notice that `auth` is to be left 32 empty, `serveraddress` is a domain/ip without protocol, and that double 33 quotes (instead of single ones) are required. 34 - The Remote API uses an open schema model. In this model, unknown 35 properties in incoming messages will be ignored. 36 Client applications need to take this into account to ensure 37 they will not break when talking to newer Docker daemons. 38 39 The current version of the API is v1.20 40 41 Calling `/info` is the same as calling 42 `/v1.20/info`. 43 44 You can still call an old version of the API using 45 `/v1.19/info`. 46 47 ## Docker Events 48 49 The following diagram depicts the container states accessible through the API. 50 51 ![States](../images/event_state.png) 52 53 Some container-related events are not affected by container state, so they are not included in this diagram. These events are: 54 55 * **export** emitted by `docker export` 56 * **exec_create** emitted by `docker exec` 57 * **exec_start** emitted by `docker exec` after **exec_create** 58 59 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. 60 61 > **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/). 62 63 ## v1.20 64 65 ### Full documentation 66 67 [*Docker Remote API v1.20*](/reference/api/docker_remote_api_v1.20/) 68 69 ### What's new 70 71 `GET /containers/(id)/archive` 72 73 **New!** 74 Get an archive of filesystem content from a container. 75 76 `PUT /containers/(id)/archive` 77 78 **New!** 79 Upload an archive of content to be extracted to an 80 existing directory inside a container's filesystem. 81 82 `POST /containers/(id)/copy` 83 84 **Deprecated!** 85 This copy endpoint has been deprecated in favor of the above `archive` endpoint 86 which can be used to download files and directories from a container. 87 88 **New!** 89 The `hostConfig` option now accepts the field `GroupAdd`, which specifies a list of additional 90 groups that the container process will run as. 91 92 ## v1.19 93 94 ### Full documentation 95 96 [*Docker Remote API v1.19*](/reference/api/docker_remote_api_v1.19/) 97 98 ### What's new 99 100 **New!** 101 When the daemon detects a version mismatch with the client, usually when 102 the client is newer than the daemon, an HTTP 400 is now returned instead 103 of a 404. 104 105 `GET /containers/(id)/stats` 106 107 **New!** 108 You can now supply a `stream` bool to get only one set of stats and 109 disconnect 110 111 `GET /containers/(id)/logs` 112 113 **New!** 114 115 This endpoint now accepts a `since` timestamp parameter. 116 117 `GET /info` 118 119 **New!** 120 121 The fields `Debug`, `IPv4Forwarding`, `MemoryLimit`, and `SwapLimit` 122 are now returned as boolean instead of as an int. 123 124 In addition, the end point now returns the new boolean fields 125 `CpuCfsPeriod`, `CpuCfsQuota`, and `OomKillDisable`. 126 127 ## v1.18 128 129 ### Full documentation 130 131 [*Docker Remote API v1.18*](/reference/api/docker_remote_api_v1.18/) 132 133 ### What's new 134 135 `GET /version` 136 137 **New!** 138 This endpoint now returns `Os`, `Arch` and `KernelVersion`. 139 140 `POST /containers/create` 141 142 `POST /containers/(id)/start` 143 144 **New!** 145 You can set ulimit settings to be used within the container. 146 147 `GET /info` 148 149 **New!** 150 This endpoint now returns `SystemTime`, `HttpProxy`,`HttpsProxy` and `NoProxy`. 151 152 `GET /images/json` 153 154 **New!** 155 Added a `RepoDigests` field to include image digest information. 156 157 `POST /build` 158 159 **New!** 160 Builds can now set resource constraints for all containers created for the build. 161 162 **New!** 163 (`CgroupParent`) can be passed in the host config to setup container cgroups under a specific cgroup. 164 165 `POST /build` 166 167 **New!** 168 Closing the HTTP request will now cause the build to be canceled. 169 170 `POST /containers/(id)/exec` 171 172 **New!** 173 Add `Warnings` field to response. 174 175 ## v1.17 176 177 ### Full documentation 178 179 [*Docker Remote API v1.17*](/reference/api/docker_remote_api_v1.17/) 180 181 ### What's new 182 183 The build supports `LABEL` command. Use this to add metadata 184 to an image. For example you could add data describing the content of an image. 185 186 `LABEL "com.example.vendor"="ACME Incorporated"` 187 188 **New!** 189 `POST /containers/(id)/attach` and `POST /exec/(id)/start` 190 191 **New!** 192 Docker client now hints potential proxies about connection hijacking using HTTP Upgrade headers. 193 194 `POST /containers/create` 195 196 **New!** 197 You can set labels on container create describing the container. 198 199 `GET /containers/json` 200 201 **New!** 202 The endpoint returns the labels associated with the containers (`Labels`). 203 204 `GET /containers/(id)/json` 205 206 **New!** 207 This endpoint now returns the list current execs associated with the container (`ExecIDs`). 208 This endpoint now returns the container labels (`Config.Labels`). 209 210 `POST /containers/(id)/rename` 211 212 **New!** 213 New endpoint to rename a container `id` to a new name. 214 215 `POST /containers/create` 216 `POST /containers/(id)/start` 217 218 **New!** 219 (`ReadonlyRootfs`) can be passed in the host config to mount the container's 220 root filesystem as read only. 221 222 `GET /containers/(id)/stats` 223 224 **New!** 225 This endpoint returns a live stream of a container's resource usage statistics. 226 227 `GET /images/json` 228 229 **New!** 230 This endpoint now returns the labels associated with each image (`Labels`). 231 232 233 ## v1.16 234 235 ### Full documentation 236 237 [*Docker Remote API v1.16*](/reference/api/docker_remote_api_v1.16/) 238 239 ### What's new 240 241 `GET /info` 242 243 **New!** 244 `info` now returns the number of CPUs available on the machine (`NCPU`), 245 total memory available (`MemTotal`), a user-friendly name describing the running Docker daemon (`Name`), a unique ID identifying the daemon (`ID`), and 246 a list of daemon labels (`Labels`). 247 248 `POST /containers/create` 249 250 **New!** 251 You can set the new container's MAC address explicitly. 252 253 **New!** 254 Volumes are now initialized when the container is created. 255 256 `POST /containers/(id)/copy` 257 258 **New!** 259 You can now copy data which is contained in a volume. 260 261 ## v1.15 262 263 ### Full documentation 264 265 [*Docker Remote API v1.15*](/reference/api/docker_remote_api_v1.15/) 266 267 ### What's new 268 269 `POST /containers/create` 270 271 **New!** 272 It is now possible to set a container's HostConfig when creating a container. 273 Previously this was only available when starting a container. 274 275 ## v1.14 276 277 ### Full documentation 278 279 [*Docker Remote API v1.14*](/reference/api/docker_remote_api_v1.14/) 280 281 ### What's new 282 283 `DELETE /containers/(id)` 284 285 **New!** 286 When using `force`, the container will be immediately killed with SIGKILL. 287 288 `POST /containers/(id)/start` 289 290 **New!** 291 The `hostConfig` option now accepts the field `CapAdd`, which specifies a list of capabilities 292 to add, and the field `CapDrop`, which specifies a list of capabilities to drop. 293 294 `POST /images/create` 295 296 **New!** 297 The `fromImage` and `repo` parameters now supports the `repo:tag` format. 298 Consequently, the `tag` parameter is now obsolete. Using the new format and 299 the `tag` parameter at the same time will return an error. 300 301