github.com/fcwu/docker@v1.4.2-0.20150115145920-2a69ca89f0df/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.17 34 35 Calling `/info` is the same as calling 36 `/v1.17/info`. 37 38 You can still call an old version of the API using 39 `/v1.16/info`. 40 41 ## v1.17 42 43 ### Full Documentation 44 45 [*Docker Remote API v1.17*](/reference/api/docker_remote_api_v1.17/) 46 47 ### What's new 48 49 `POST /containers/(id)/attach` and `POST /exec/(id)/start` 50 51 **New!** 52 Docker client now hints potential proxies about connection hijacking using HTTP Upgrade headers. 53 54 `GET /containers/(id)/json` 55 56 **New!** 57 This endpoint now returns the list current execs associated with the container (`ExecIDs`). 58 59 ## v1.16 60 61 ### Full Documentation 62 63 [*Docker Remote API v1.16*](/reference/api/docker_remote_api_v1.16/) 64 65 ### What's new 66 67 `GET /info` 68 69 **New!** 70 `info` now returns the number of CPUs available on the machine (`NCPU`), 71 total memory available (`MemTotal`), a user-friendly name describing the running Docker daemon (`Name`), a unique ID identifying the daemon (`ID`), and 72 a list of daemon labels (`Labels`). 73 74 `POST /containers/create` 75 76 **New!** 77 You can set the new container's MAC address explicitly. 78 79 **New!** 80 Volumes are now initialized when the container is created. 81 82 `POST /containers/(id)/copy` 83 84 **New!** 85 You can now copy data which is contained in a volume. 86 87 ## v1.15 88 89 ### Full Documentation 90 91 [*Docker Remote API v1.15*](/reference/api/docker_remote_api_v1.15/) 92 93 ### What's new 94 95 `POST /containers/create` 96 97 **New!** 98 It is now possible to set a container's HostConfig when creating a container. 99 Previously this was only available when starting a container. 100 101 ## v1.14 102 103 ### Full Documentation 104 105 [*Docker Remote API v1.14*](/reference/api/docker_remote_api_v1.14/) 106 107 ### What's new 108 109 `DELETE /containers/(id)` 110 111 **New!** 112 When using `force`, the container will be immediately killed with SIGKILL. 113 114 `POST /containers/(id)/start` 115 116 **New!** 117 The `hostConfig` option now accepts the field `CapAdd`, which specifies a list of capabilities 118 to add, and the field `CapDrop`, which specifies a list of capabilities to drop. 119 120 `POST /images/create` 121 122 **New!** 123 The `fromImage` and `repo` parameters now supports the `repo:tag` format. 124 Consequently, the `tag` parameter is now obsolete. Using the new format and 125 the `tag` parameter at the same time will return an error. 126 127 ## v1.13 128 129 ### Full Documentation 130 131 [*Docker Remote API v1.13*](/reference/api/docker_remote_api_v1.13/) 132 133 ### What's new 134 135 `GET /containers/(name)/json` 136 137 **New!** 138 The `HostConfig.Links` field is now filled correctly 139 140 **New!** 141 `Sockets` parameter added to the `/info` endpoint listing all the sockets the 142 daemon is configured to listen on. 143 144 `POST /containers/(name)/start` 145 `POST /containers/(name)/stop` 146 147 **New!** 148 `start` and `stop` will now return 304 if the container's status is not modified 149 150 `POST /commit` 151 152 **New!** 153 Added a `pause` parameter (default `true`) to pause the container during commit 154 155 ## v1.12 156 157 ### Full Documentation 158 159 [*Docker Remote API v1.12*](/reference/api/docker_remote_api_v1.12/) 160 161 ### What's new 162 163 `POST /build` 164 165 **New!** 166 Build now has support for the `forcerm` parameter to always remove containers 167 168 `GET /containers/(name)/json` 169 `GET /images/(name)/json` 170 171 **New!** 172 All the JSON keys are now in CamelCase 173 174 **New!** 175 Trusted builds are now Automated Builds - `is_trusted` is now `is_automated`. 176 177 **Removed Insert Endpoint** 178 The `insert` endpoint has been removed. 179 180 ## v1.11 181 182 ### Full Documentation 183 184 [*Docker Remote API v1.11*](/reference/api/docker_remote_api_v1.11/) 185 186 ### What's new 187 188 `GET /_ping` 189 190 **New!** 191 You can now ping the server via the `_ping` endpoint. 192 193 `GET /events` 194 195 **New!** 196 You can now use the `-until` parameter to close connection 197 after timestamp. 198 199 `GET /containers/(id)/logs` 200 201 This url is preferred method for getting container logs now. 202 203 ## v1.10 204 205 ### Full Documentation 206 207 [*Docker Remote API v1.10*](/reference/api/docker_remote_api_v1.10/) 208 209 ### What's new 210 211 `DELETE /images/(name)` 212 213 **New!** 214 You can now use the force parameter to force delete of an 215 image, even if it's tagged in multiple repositories. **New!** 216 You 217 can now use the noprune parameter to prevent the deletion of parent 218 images 219 220 `DELETE /containers/(id)` 221 222 **New!** 223 You can now use the force parameter to force delete a 224 container, even if it is currently running 225 226 ## v1.9 227 228 ### Full Documentation 229 230 [*Docker Remote API v1.9*](/reference/api/docker_remote_api_v1.9/) 231 232 ### What's new 233 234 `POST /build` 235 236 **New!** 237 This endpoint now takes a serialized ConfigFile which it 238 uses to resolve the proper registry auth credentials for pulling the 239 base image. Clients which previously implemented the version 240 accepting an AuthConfig object must be updated. 241 242 ## v1.8 243 244 ### Full Documentation 245 246 [*Docker Remote API v1.8*](/reference/api/docker_remote_api_v1.8/) 247 248 ### What's new 249 250 `POST /build` 251 252 **New!** 253 This endpoint now returns build status as json stream. In 254 case of a build error, it returns the exit status of the failed 255 command. 256 257 `GET /containers/(id)/json` 258 259 **New!** 260 This endpoint now returns the host config for the 261 container. 262 263 `POST /images/create` 264 265 `POST /images/(name)/insert` 266 267 `POST /images/(name)/push` 268 269 **New!** 270 progressDetail object was added in the JSON. It's now 271 possible to get the current value and the total of the progress 272 without having to parse the string. 273 274 ## v1.7 275 276 ### Full Documentation 277 278 [*Docker Remote API v1.7*](/reference/api/docker_remote_api_v1.7/) 279 280 ### What's new 281 282 `GET /images/json` 283 284 The format of the json returned from this uri changed. Instead of an 285 entry for each repo/tag on an image, each image is only represented 286 once, with a nested attribute indicating the repo/tags that apply to 287 that image. 288 289 Instead of: 290 291 HTTP/1.1 200 OK 292 Content-Type: application/json 293 294 [ 295 { 296 "VirtualSize": 131506275, 297 "Size": 131506275, 298 "Created": 1365714795, 299 "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c", 300 "Tag": "12.04", 301 "Repository": "ubuntu" 302 }, 303 { 304 "VirtualSize": 131506275, 305 "Size": 131506275, 306 "Created": 1365714795, 307 "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c", 308 "Tag": "latest", 309 "Repository": "ubuntu" 310 }, 311 { 312 "VirtualSize": 131506275, 313 "Size": 131506275, 314 "Created": 1365714795, 315 "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c", 316 "Tag": "precise", 317 "Repository": "ubuntu" 318 }, 319 { 320 "VirtualSize": 180116135, 321 "Size": 24653, 322 "Created": 1364102658, 323 "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", 324 "Tag": "12.10", 325 "Repository": "ubuntu" 326 }, 327 { 328 "VirtualSize": 180116135, 329 "Size": 24653, 330 "Created": 1364102658, 331 "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", 332 "Tag": "quantal", 333 "Repository": "ubuntu" 334 } 335 ] 336 337 The returned json looks like this: 338 339 HTTP/1.1 200 OK 340 Content-Type: application/json 341 342 [ 343 { 344 "RepoTags": [ 345 "ubuntu:12.04", 346 "ubuntu:precise", 347 "ubuntu:latest" 348 ], 349 "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c", 350 "Created": 1365714795, 351 "Size": 131506275, 352 "VirtualSize": 131506275 353 }, 354 { 355 "RepoTags": [ 356 "ubuntu:12.10", 357 "ubuntu:quantal" 358 ], 359 "ParentId": "27cf784147099545", 360 "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", 361 "Created": 1364102658, 362 "Size": 24653, 363 "VirtualSize": 180116135 364 } 365 ] 366 367 `GET /images/viz` 368 369 This URI no longer exists. The `images --viz` 370 output is now generated in the client, using the 371 `/images/json` data. 372 373 ## v1.6 374 375 ### Full Documentation 376 377 [*Docker Remote API v1.6*](/reference/api/docker_remote_api_v1.6/) 378 379 ### What's new 380 381 `POST /containers/(id)/attach` 382 383 **New!** 384 You can now split stderr from stdout. This is done by 385 prefixing a header to each transmission. See 386 [`POST /containers/(id)/attach`]( 387 /reference/api/docker_remote_api_v1.9/#attach-to-a-container "POST /containers/(id)/attach"). 388 The WebSocket attach is unchanged. Note that attach calls on the 389 previous API version didn't change. Stdout and stderr are merged. 390 391 ## v1.5 392 393 ### Full Documentation 394 395 [*Docker Remote API v1.5*](/reference/api/docker_remote_api_v1.5/) 396 397 ### What's new 398 399 `POST /images/create` 400 401 **New!** 402 You can now pass registry credentials (via an AuthConfig 403 object) through the X-Registry-Auth header 404 405 `POST /images/(name)/push` 406 407 **New!** 408 The AuthConfig object now needs to be passed through the 409 X-Registry-Auth header 410 411 `GET /containers/json` 412 413 **New!** 414 The format of the Ports entry has been changed to a list of 415 dicts each containing PublicPort, PrivatePort and Type describing a 416 port mapping. 417 418 ## v1.4 419 420 ### Full Documentation 421 422 [*Docker Remote API v1.4*](/reference/api/docker_remote_api_v1.4/) 423 424 ### What's new 425 426 `POST /images/create` 427 428 **New!** 429 When pulling a repo, all images are now downloaded in parallel. 430 431 `GET /containers/(id)/top` 432 433 **New!** 434 You can now use ps args with docker top, like docker top 435 <container_id> aux 436 437 `GET /events` 438 439 **New!** 440 Image's name added in the events 441 442 ## v1.3 443 444 docker v0.5.0 445 [51f6c4a](https://github.com/docker/docker/commit/51f6c4a7372450d164c61e0054daf0223ddbd909) 446 447 ### Full Documentation 448 449 [*Docker Remote API v1.3*](/reference/api/docker_remote_api_v1.3/) 450 451 ### What's new 452 453 `GET /containers/(id)/top` 454 455 List the processes running inside a container. 456 457 `GET /events` 458 459 **New!** 460 Monitor docker's events via streaming or via polling 461 462 Builder (/build): 463 464 - Simplify the upload of the build context 465 - Simply stream a tarball instead of multipart upload with 4 466 intermediary buffers 467 - Simpler, less memory usage, less disk usage and faster 468 469 > **Warning**: 470 > The /build improvements are not reverse-compatible. Pre 1.3 clients will 471 > break on /build. 472 473 List containers (/containers/json): 474 475 - You can use size=1 to get the size of the containers 476 477 Start containers (/containers/<id>/start): 478 479 - You can now pass host-specific configuration (e.g., bind mounts) in 480 the POST body for start calls 481 482 ## v1.2 483 484 docker v0.4.2 485 [2e7649b](https://github.com/docker/docker/commit/2e7649beda7c820793bd46766cbc2cfeace7b168) 486 487 ### Full Documentation 488 489 [*Docker Remote API v1.2*](/reference/api/docker_remote_api_v1.2/) 490 491 ### What's new 492 493 The auth configuration is now handled by the client. 494 495 The client should send it's authConfig as POST on each call of 496 `/images/(name)/push` 497 498 `GET /auth` 499 500 **Deprecated.** 501 502 `POST /auth` 503 504 Only checks the configuration but doesn't store it on the server 505 506 Deleting an image is now improved, will only untag the image if it 507 has children and remove all the untagged parents if has any. 508 509 `POST /images/<name>/delete` 510 511 Now returns a JSON structure with the list of images 512 deleted/untagged. 513 514 ## v1.1 515 516 docker v0.4.0 517 [a8ae398](https://github.com/docker/docker/commit/a8ae398bf52e97148ee7bd0d5868de2e15bd297f) 518 519 ### Full Documentation 520 521 [*Docker Remote API v1.1*](/reference/api/docker_remote_api_v1.1/) 522 523 ### What's new 524 525 `POST /images/create` 526 527 `POST /images/(name)/insert` 528 529 `POST /images/(name)/push` 530 531 Uses json stream instead of HTML hijack, it looks like this: 532 533 HTTP/1.1 200 OK 534 Content-Type: application/json 535 536 {"status":"Pushing..."} 537 {"status":"Pushing", "progress":"1/? (n/a)"} 538 {"error":"Invalid..."} 539 ... 540 541 ## v1.0 542 543 docker v0.3.4 544 [8d73740](https://github.com/docker/docker/commit/8d73740343778651c09160cde9661f5f387b36f4) 545 546 ### Full Documentation 547 548 [*Docker Remote API v1.0*](/reference/api/docker_remote_api_v1.0/) 549 550 ### What's new 551 552 Initial version