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