github.com/slene/docker@v1.8.0-rc1/docs/reference/api/docker_remote_api_v1.15.md (about) 1 <!--[metadata]> 2 +++ 3 title = "Remote API v1.15" 4 description = "API Documentation for Docker" 5 keywords = ["API, Docker, rcli, REST, documentation"] 6 [menu.main] 7 parent = "smn_remoteapi" 8 weight = 6 9 +++ 10 <![end-metadata]--> 11 12 # Docker Remote API v1.15 13 14 ## 1. Brief introduction 15 16 - The Remote API has replaced `rcli`. 17 - The daemon listens on `unix:///var/run/docker.sock` but you can 18 [Bind Docker to another host/port or a Unix socket]( 19 /articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket). 20 - The API tends to be REST, but for some complex commands, like `attach` 21 or `pull`, the HTTP connection is hijacked to transport `STDOUT`, 22 `STDIN` and `STDERR`. 23 24 # 2. Endpoints 25 26 ## 2.1 Containers 27 28 ### List containers 29 30 `GET /containers/json` 31 32 List containers 33 34 **Example request**: 35 36 GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1 37 38 **Example response**: 39 40 HTTP/1.1 200 OK 41 Content-Type: application/json 42 43 [ 44 { 45 "Id": "8dfafdbc3a40", 46 "Names":["/boring_feynman"], 47 "Image": "ubuntu:latest", 48 "Command": "echo 1", 49 "Created": 1367854155, 50 "Status": "Exit 0", 51 "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}], 52 "SizeRw": 12288, 53 "SizeRootFs": 0 54 }, 55 { 56 "Id": "9cd87474be90", 57 "Names":["/coolName"], 58 "Image": "ubuntu:latest", 59 "Command": "echo 222222", 60 "Created": 1367854155, 61 "Status": "Exit 0", 62 "Ports": [], 63 "SizeRw": 12288, 64 "SizeRootFs": 0 65 }, 66 { 67 "Id": "3176a2479c92", 68 "Names":["/sleepy_dog"], 69 "Image": "ubuntu:latest", 70 "Command": "echo 3333333333333333", 71 "Created": 1367854154, 72 "Status": "Exit 0", 73 "Ports":[], 74 "SizeRw":12288, 75 "SizeRootFs":0 76 }, 77 { 78 "Id": "4cb07b47f9fb", 79 "Names":["/running_cat"], 80 "Image": "ubuntu:latest", 81 "Command": "echo 444444444444444444444444444444444", 82 "Created": 1367854152, 83 "Status": "Exit 0", 84 "Ports": [], 85 "SizeRw": 12288, 86 "SizeRootFs": 0 87 } 88 ] 89 90 Query Parameters: 91 92 - **all** – 1/True/true or 0/False/false, Show all containers. 93 Only running containers are shown by default (i.e., this defaults to false) 94 - **limit** – Show `limit` last created 95 containers, include non-running ones. 96 - **since** – Show only containers created since Id, include 97 non-running ones. 98 - **before** – Show only containers created before Id, include 99 non-running ones. 100 - **size** – 1/True/true or 0/False/false, Show the containers 101 sizes 102 - **filters** - a json encoded value of the filters (a map[string][]string) to process on the containers list. Available filters: 103 - exited=<int> -- containers with exit code of <int> 104 - status=(restarting|running|paused|exited) 105 106 Status Codes: 107 108 - **200** – no error 109 - **400** – bad parameter 110 - **500** – server error 111 112 ### Create a container 113 114 `POST /containers/create` 115 116 Create a container 117 118 **Example request**: 119 120 POST /containers/create HTTP/1.1 121 Content-Type: application/json 122 123 { 124 "Hostname": "", 125 "Domainname": "", 126 "User": "", 127 "Memory": 0, 128 "MemorySwap": 0, 129 "CpuShares": 512, 130 "Cpuset": "0,1", 131 "AttachStdin": false, 132 "AttachStdout": true, 133 "AttachStderr": true, 134 "Tty": false, 135 "OpenStdin": false, 136 "StdinOnce": false, 137 "Env": null, 138 "Cmd": [ 139 "date" 140 ], 141 "Entrypoint": "", 142 "Image": "ubuntu", 143 "Volumes": { 144 "/tmp": {} 145 }, 146 "WorkingDir": "", 147 "NetworkDisabled": false, 148 "MacAddress": "12:34:56:78:9a:bc", 149 "ExposedPorts": { 150 "22/tcp": {} 151 }, 152 "SecurityOpts": [""], 153 "HostConfig": { 154 "Binds": ["/tmp:/tmp"], 155 "Links": ["redis3:redis"], 156 "LxcConf": {"lxc.utsname":"docker"}, 157 "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] }, 158 "PublishAllPorts": false, 159 "Privileged": false, 160 "Dns": ["8.8.8.8"], 161 "DnsSearch": [""], 162 "ExtraHosts": null, 163 "VolumesFrom": ["parent", "other:ro"], 164 "CapAdd": ["NET_ADMIN"], 165 "CapDrop": ["MKNOD"], 166 "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 }, 167 "NetworkMode": "bridge", 168 "Devices": [] 169 } 170 } 171 172 **Example response**: 173 174 HTTP/1.1 201 Created 175 Content-Type: application/json 176 177 { 178 "Id": "f91ddc4b01e079c4481a8340bbbeca4dbd33d6e4a10662e499f8eacbb5bf252b" 179 "Warnings": [] 180 } 181 182 Json Parameters: 183 184 - **Hostname** - A string value containing the desired hostname to use for the 185 container. 186 - **Domainname** - A string value containing the desired domain name to use 187 for the container. 188 - **User** - A string value containing the user to use inside the container. 189 - **Memory** - Memory limit in bytes. 190 - **MemorySwap**- Total memory usage (memory + swap); set `-1` to disable swap. 191 - **CpuShares** - An integer value containing the CPU Shares for container 192 (ie. the relative weight vs other containers). 193 **CpuSet** - String value containing the cgroups Cpuset to use. 194 - **AttachStdin** - Boolean value, attaches to stdin. 195 - **AttachStdout** - Boolean value, attaches to stdout. 196 - **AttachStderr** - Boolean value, attaches to stderr. 197 - **Tty** - Boolean value, Attach standard streams to a tty, including stdin if it is not closed. 198 - **OpenStdin** - Boolean value, opens stdin, 199 - **StdinOnce** - Boolean value, close stdin after the 1 attached client disconnects. 200 - **Env** - A list of environment variables in the form of `VAR=value` 201 - **Cmd** - Command to run specified as a string or an array of strings. 202 - **Entrypoint** - Set the entrypoint for the container a string or an array 203 of strings 204 - **Image** - String value containing the image name to use for the container 205 - **Volumes** – An object mapping mountpoint paths (strings) inside the 206 container to empty objects. 207 - **WorkingDir** - A string value containing the working dir for commands to 208 run in. 209 - **NetworkDisabled** - Boolean value, when true disables networking for the 210 container 211 - **ExposedPorts** - An object mapping ports to an empty object in the form of: 212 `"ExposedPorts": { "<port>/<tcp|udp>: {}" }` 213 - **SecurityOpts**: A list of string values to customize labels for MLS 214 systems, such as SELinux. 215 - **HostConfig** 216 - **Binds** – A list of volume bindings for this container. Each volume 217 binding is a string of the form `container_path` (to create a new 218 volume for the container), `host_path:container_path` (to bind-mount 219 a host path into the container), or `host_path:container_path:ro` 220 (to make the bind-mount read-only inside the container). 221 - **Links** - A list of links for the container. Each link entry should be 222 in the form of "container_name:alias". 223 - **LxcConf** - LXC specific configurations. These configurations will only 224 work when using the `lxc` execution driver. 225 - **PortBindings** - A map of exposed container ports and the host port they 226 should map to. It should be specified in the form 227 `{ <port>/<protocol>: [{ "HostPort": "<port>" }] }` 228 Take note that `port` is specified as a string and not an integer value. 229 - **PublishAllPorts** - Allocates a random host port for all of a container's 230 exposed ports. Specified as a boolean value. 231 - **Privileged** - Gives the container full access to the host. Specified as 232 a boolean value. 233 - **Dns** - A list of dns servers for the container to use. 234 - **DnsSearch** - A list of DNS search domains 235 - **ExtraHosts** - A list of hostnames/IP mappings to be added to the 236 container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`. 237 - **VolumesFrom** - A list of volumes to inherit from another container. 238 Specified in the form `<container name>[:<ro|rw>]` 239 - **CapAdd** - A list of kernel capabilities to add to the container. 240 - **Capdrop** - A list of kernel capabilities to drop from the container. 241 - **RestartPolicy** – The behavior to apply when the container exits. The 242 value is an object with a `Name` property of either `"always"` to 243 always restart or `"on-failure"` to restart only when the container 244 exit code is non-zero. If `on-failure` is used, `MaximumRetryCount` 245 controls the number of times to retry before giving up. 246 The default is not to restart. (optional) 247 An ever increasing delay (double the previous delay, starting at 100mS) 248 is added before each restart to prevent flooding the server. 249 - **NetworkMode** - Sets the networking mode for the container. Supported 250 values are: `bridge`, `host`, and `container:<name|id>` 251 - **Devices** - A list of devices to add to the container specified in the 252 form 253 `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}` 254 255 Query Parameters: 256 257 - **name** – Assign the specified name to the container. Must 258 match `/?[a-zA-Z0-9_-]+`. 259 260 Status Codes: 261 262 - **201** – no error 263 - **404** – no such container 264 - **406** – impossible to attach (container not running) 265 - **500** – server error 266 267 ### Inspect a container 268 269 `GET /containers/(id)/json` 270 271 Return low-level information on the container `id` 272 273 274 **Example request**: 275 276 GET /containers/4fa6e0f0c678/json HTTP/1.1 277 278 **Example response**: 279 280 HTTP/1.1 200 OK 281 Content-Type: application/json 282 283 { 284 "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2", 285 "Created": "2013-05-07T14:51:42.041847+02:00", 286 "Path": "date", 287 "Args": [], 288 "Config": { 289 "Hostname": "4fa6e0f0c678", 290 "User": "", 291 "Memory": 0, 292 "MemorySwap": 0, 293 "AttachStdin": false, 294 "AttachStdout": true, 295 "AttachStderr": true, 296 "PortSpecs": null, 297 "Tty": false, 298 "OpenStdin": false, 299 "StdinOnce": false, 300 "Env": null, 301 "Cmd": [ 302 "date" 303 ], 304 "Dns": null, 305 "Image": "ubuntu", 306 "Volumes": {}, 307 "VolumesFrom": "", 308 "WorkingDir": "" 309 }, 310 "State": { 311 "Running": false, 312 "Pid": 0, 313 "ExitCode": 0, 314 "StartedAt": "2013-05-07T14:51:42.087658+02:01360", 315 "Ghost": false 316 }, 317 "Image": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", 318 "NetworkSettings": { 319 "IpAddress": "", 320 "IpPrefixLen": 0, 321 "Gateway": "", 322 "Bridge": "", 323 "PortMapping": null 324 }, 325 "SysInitPath": "/home/kitty/go/src/github.com/docker/docker/bin/docker", 326 "ResolvConfPath": "/etc/resolv.conf", 327 "Volumes": {}, 328 "HostConfig": { 329 "Binds": null, 330 "ContainerIDFile": "", 331 "LxcConf": [], 332 "Privileged": false, 333 "PortBindings": { 334 "80/tcp": [ 335 { 336 "HostIp": "0.0.0.0", 337 "HostPort": "49153" 338 } 339 ] 340 }, 341 "Links": ["/name:alias"], 342 "PublishAllPorts": false, 343 "CapAdd": ["NET_ADMIN"], 344 "CapDrop": ["MKNOD"] 345 } 346 } 347 348 Status Codes: 349 350 - **200** – no error 351 - **404** – no such container 352 - **500** – server error 353 354 ### List processes running inside a container 355 356 `GET /containers/(id)/top` 357 358 List processes running inside the container `id` 359 360 **Example request**: 361 362 GET /containers/4fa6e0f0c678/top HTTP/1.1 363 364 **Example response**: 365 366 HTTP/1.1 200 OK 367 Content-Type: application/json 368 369 { 370 "Titles": [ 371 "USER", 372 "PID", 373 "%CPU", 374 "%MEM", 375 "VSZ", 376 "RSS", 377 "TTY", 378 "STAT", 379 "START", 380 "TIME", 381 "COMMAND" 382 ], 383 "Processes": [ 384 ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"], 385 ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"] 386 ] 387 } 388 389 Query Parameters: 390 391 - **ps_args** – ps arguments to use (e.g., aux) 392 393 Status Codes: 394 395 - **200** – no error 396 - **404** – no such container 397 - **500** – server error 398 399 ### Get container logs 400 401 `GET /containers/(id)/logs` 402 403 Get stdout and stderr logs from the container ``id`` 404 405 **Example request**: 406 407 GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1×tamps=1&follow=1&tail=10 HTTP/1.1 408 409 **Example response**: 410 411 HTTP/1.1 200 OK 412 Content-Type: application/vnd.docker.raw-stream 413 414 {{ STREAM }} 415 416 Query Parameters: 417 418 - **follow** – 1/True/true or 0/False/false, return stream. Default false 419 - **stdout** – 1/True/true or 0/False/false, show stdout log. Default false 420 - **stderr** – 1/True/true or 0/False/false, show stderr log. Default false 421 - **timestamps** – 1/True/true or 0/False/false, print timestamps for 422 every log line. Default false 423 - **tail** – Output specified number of lines at the end of logs: `all` or `<number>`. Default all 424 425 Status Codes: 426 427 - **200** – no error 428 - **404** – no such container 429 - **500** – server error 430 431 ### Inspect changes on a container's filesystem 432 433 `GET /containers/(id)/changes` 434 435 Inspect changes on container `id`'s filesystem 436 437 **Example request**: 438 439 GET /containers/4fa6e0f0c678/changes HTTP/1.1 440 441 **Example response**: 442 443 HTTP/1.1 200 OK 444 Content-Type: application/json 445 446 [ 447 { 448 "Path": "/dev", 449 "Kind": 0 450 }, 451 { 452 "Path": "/dev/kmsg", 453 "Kind": 1 454 }, 455 { 456 "Path": "/test", 457 "Kind": 1 458 } 459 ] 460 461 Status Codes: 462 463 - **200** – no error 464 - **404** – no such container 465 - **500** – server error 466 467 ### Export a container 468 469 `GET /containers/(id)/export` 470 471 Export the contents of container `id` 472 473 **Example request**: 474 475 GET /containers/4fa6e0f0c678/export HTTP/1.1 476 477 **Example response**: 478 479 HTTP/1.1 200 OK 480 Content-Type: application/octet-stream 481 482 {{ TAR STREAM }} 483 484 Status Codes: 485 486 - **200** – no error 487 - **404** – no such container 488 - **500** – server error 489 490 ### Resize a container TTY 491 492 `GET /containers/(id)/resize?h=<height>&w=<width>` 493 494 Resize the TTY of container `id` 495 496 **Example request**: 497 498 GET /containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1 499 500 **Example response**: 501 502 HTTP/1.1 200 OK 503 Content-Length: 0 504 Content-Type: text/plain; charset=utf-8 505 506 Status Codes: 507 508 - **200** – no error 509 - **404** – No such container 510 - **500** – bad file descriptor 511 512 ### Start a container 513 514 `POST /containers/(id)/start` 515 516 Start the container `id` 517 518 **Example request**: 519 520 POST /containers/(id)/start HTTP/1.1 521 Content-Type: application/json 522 523 { 524 "Binds": ["/tmp:/tmp"], 525 "Links": ["redis3:redis"], 526 "LxcConf": {"lxc.utsname":"docker"}, 527 "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] }, 528 "PublishAllPorts": false, 529 "Privileged": false, 530 "Dns": ["8.8.8.8"], 531 "DnsSearch": [""], 532 "VolumesFrom": ["parent", "other:ro"], 533 "CapAdd": ["NET_ADMIN"], 534 "CapDrop": ["MKNOD"], 535 "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 }, 536 "NetworkMode": "bridge", 537 "Devices": [] 538 } 539 540 **Example response**: 541 542 HTTP/1.1 204 No Content 543 544 Json Parameters: 545 546 - **Binds** – A list of volume bindings for this container. Each volume 547 binding is a string of the form `container_path` (to create a new 548 volume for the container), `host_path:container_path` (to bind-mount 549 a host path into the container), or `host_path:container_path:ro` 550 (to make the bind-mount read-only inside the container). 551 - **Links** - A list of links for the container. Each link entry should be of 552 of the form "container_name:alias". 553 - **LxcConf** - LXC specific configurations. These configurations will only 554 work when using the `lxc` execution driver. 555 - **PortBindings** - A map of exposed container ports and the host port they 556 should map to. It should be specified in the form 557 `{ <port>/<protocol>: [{ "HostPort": "<port>" }] }` 558 Take note that `port` is specified as a string and not an integer value. 559 - **PublishAllPorts** - Allocates a random host port for all of a container's 560 exposed ports. Specified as a boolean value. 561 - **Privileged** - Gives the container full access to the host. Specified as 562 a boolean value. 563 - **Dns** - A list of dns servers for the container to use. 564 - **DnsSearch** - A list of DNS search domains 565 - **VolumesFrom** - A list of volumes to inherit from another container. 566 Specified in the form `<container name>[:<ro|rw>]` 567 - **CapAdd** - A list of kernel capabilities to add to the container. 568 - **Capdrop** - A list of kernel capabilities to drop from the container. 569 - **RestartPolicy** – The behavior to apply when the container exits. The 570 value is an object with a `Name` property of either `"always"` to 571 always restart or `"on-failure"` to restart only when the container 572 exit code is non-zero. If `on-failure` is used, `MaximumRetryCount` 573 controls the number of times to retry before giving up. 574 The default is not to restart. (optional) 575 An ever increasing delay (double the previous delay, starting at 100mS) 576 is added before each restart to prevent flooding the server. 577 - **NetworkMode** - Sets the networking mode for the container. Supported 578 values are: `bridge`, `host`, and `container:<name|id>` 579 - **Devices** - A list of devices to add to the container specified in the 580 form 581 `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}` 582 583 Status Codes: 584 585 - **204** – no error 586 - **304** – container already started 587 - **404** – no such container 588 - **500** – server error 589 590 ### Stop a container 591 592 `POST /containers/(id)/stop` 593 594 Stop the container `id` 595 596 **Example request**: 597 598 POST /containers/e90e34656806/stop?t=5 HTTP/1.1 599 600 **Example response**: 601 602 HTTP/1.1 204 No Content 603 604 Query Parameters: 605 606 - **t** – number of seconds to wait before killing the container 607 608 Status Codes: 609 610 - **204** – no error 611 - **304** – container already stopped 612 - **404** – no such container 613 - **500** – server error 614 615 ### Restart a container 616 617 `POST /containers/(id)/restart` 618 619 Restart the container `id` 620 621 **Example request**: 622 623 POST /containers/e90e34656806/restart?t=5 HTTP/1.1 624 625 **Example response**: 626 627 HTTP/1.1 204 No Content 628 629 Query Parameters: 630 631 - **t** – number of seconds to wait before killing the container 632 633 Status Codes: 634 635 - **204** – no error 636 - **404** – no such container 637 - **500** – server error 638 639 ### Kill a container 640 641 `POST /containers/(id)/kill` 642 643 Kill the container `id` 644 645 **Example request**: 646 647 POST /containers/e90e34656806/kill HTTP/1.1 648 649 **Example response**: 650 651 HTTP/1.1 204 No Content 652 653 Query Parameters 654 655 - **signal** - Signal to send to the container: integer or string like "SIGINT". 656 When not set, SIGKILL is assumed and the call will waits for the container to exit. 657 658 Status Codes: 659 660 - **204** – no error 661 - **404** – no such container 662 - **500** – server error 663 664 ### Pause a container 665 666 `POST /containers/(id)/pause` 667 668 Pause the container `id` 669 670 **Example request**: 671 672 POST /containers/e90e34656806/pause HTTP/1.1 673 674 **Example response**: 675 676 HTTP/1.1 204 No Content 677 678 Status Codes: 679 680 - **204** – no error 681 - **404** – no such container 682 - **500** – server error 683 684 ### Unpause a container 685 686 `POST /containers/(id)/unpause` 687 688 Unpause the container `id` 689 690 **Example request**: 691 692 POST /containers/e90e34656806/unpause HTTP/1.1 693 694 **Example response**: 695 696 HTTP/1.1 204 No Content 697 698 Status Codes: 699 700 - **204** – no error 701 - **404** – no such container 702 - **500** – server error 703 704 ### Attach to a container 705 706 `POST /containers/(id)/attach` 707 708 Attach to the container `id` 709 710 **Example request**: 711 712 POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1 713 714 **Example response**: 715 716 HTTP/1.1 200 OK 717 Content-Type: application/vnd.docker.raw-stream 718 719 {{ STREAM }} 720 721 Query Parameters: 722 723 - **logs** – 1/True/true or 0/False/false, return logs. Default false 724 - **stream** – 1/True/true or 0/False/false, return stream. 725 Default false 726 - **stdin** – 1/True/true or 0/False/false, if stream=true, attach 727 to stdin. Default false 728 - **stdout** – 1/True/true or 0/False/false, if logs=true, return 729 stdout log, if stream=true, attach to stdout. Default false 730 - **stderr** – 1/True/true or 0/False/false, if logs=true, return 731 stderr log, if stream=true, attach to stderr. Default false 732 733 Status Codes: 734 735 - **200** – no error 736 - **400** – bad parameter 737 - **404** – no such container 738 - **500** – server error 739 740 **Stream details**: 741 742 When using the TTY setting is enabled in 743 [`POST /containers/create` 744 ](/reference/api/docker_remote_api_v1.9/#create-a-container "POST /containers/create"), 745 the stream is the raw data from the process PTY and client's stdin. 746 When the TTY is disabled, then the stream is multiplexed to separate 747 stdout and stderr. 748 749 The format is a **Header** and a **Payload** (frame). 750 751 **HEADER** 752 753 The header will contain the information on which stream write the 754 stream (stdout or stderr). It also contain the size of the 755 associated frame encoded on the last 4 bytes (uint32). 756 757 It is encoded on the first 8 bytes like this: 758 759 header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4} 760 761 `STREAM_TYPE` can be: 762 763 - 0: stdin (will be written on stdout) 764 - 1: stdout 765 - 2: stderr 766 767 `SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of 768 the uint32 size encoded as big endian. 769 770 **PAYLOAD** 771 772 The payload is the raw stream. 773 774 **IMPLEMENTATION** 775 776 The simplest way to implement the Attach protocol is the following: 777 778 1. Read 8 bytes 779 2. chose stdout or stderr depending on the first byte 780 3. Extract the frame size from the last 4 bytes 781 4. Read the extracted size and output it on the correct output 782 5. Goto 1 783 784 ### Attach to a container (websocket) 785 786 `GET /containers/(id)/attach/ws` 787 788 Attach to the container `id` via websocket 789 790 Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455) 791 792 **Example request** 793 794 GET /containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1 795 796 **Example response** 797 798 {{ STREAM }} 799 800 Query Parameters: 801 802 - **logs** – 1/True/true or 0/False/false, return logs. Default false 803 - **stream** – 1/True/true or 0/False/false, return stream. 804 Default false 805 - **stdin** – 1/True/true or 0/False/false, if stream=true, attach 806 to stdin. Default false 807 - **stdout** – 1/True/true or 0/False/false, if logs=true, return 808 stdout log, if stream=true, attach to stdout. Default false 809 - **stderr** – 1/True/true or 0/False/false, if logs=true, return 810 stderr log, if stream=true, attach to stderr. Default false 811 812 Status Codes: 813 814 - **200** – no error 815 - **400** – bad parameter 816 - **404** – no such container 817 - **500** – server error 818 819 ### Wait a container 820 821 `POST /containers/(id)/wait` 822 823 Block until container `id` stops, then returns the exit code 824 825 **Example request**: 826 827 POST /containers/16253994b7c4/wait HTTP/1.1 828 829 **Example response**: 830 831 HTTP/1.1 200 OK 832 Content-Type: application/json 833 834 {"StatusCode": 0} 835 836 Status Codes: 837 838 - **200** – no error 839 - **404** – no such container 840 - **500** – server error 841 842 ### Remove a container 843 844 `DELETE /containers/(id)` 845 846 Remove the container `id` from the filesystem 847 848 **Example request**: 849 850 DELETE /containers/16253994b7c4?v=1 HTTP/1.1 851 852 **Example response**: 853 854 HTTP/1.1 204 No Content 855 856 Query Parameters: 857 858 - **v** – 1/True/true or 0/False/false, Remove the volumes 859 associated to the container. Default false 860 - **force** - 1/True/true or 0/False/false, Kill then remove the container. 861 Default false 862 863 Status Codes: 864 865 - **204** – no error 866 - **400** – bad parameter 867 - **404** – no such container 868 - **500** – server error 869 870 ### Copy files or folders from a container 871 872 `POST /containers/(id)/copy` 873 874 Copy files or folders of container `id` 875 876 **Example request**: 877 878 POST /containers/4fa6e0f0c678/copy HTTP/1.1 879 Content-Type: application/json 880 881 { 882 "Resource": "test.txt" 883 } 884 885 **Example response**: 886 887 HTTP/1.1 200 OK 888 Content-Type: application/x-tar 889 890 {{ TAR STREAM }} 891 892 Status Codes: 893 894 - **200** – no error 895 - **404** – no such container 896 - **500** – server error 897 898 ## 2.2 Images 899 900 ### List Images 901 902 `GET /images/json` 903 904 **Example request**: 905 906 GET /images/json?all=0 HTTP/1.1 907 908 **Example response**: 909 910 HTTP/1.1 200 OK 911 Content-Type: application/json 912 913 [ 914 { 915 "RepoTags": [ 916 "ubuntu:12.04", 917 "ubuntu:precise", 918 "ubuntu:latest" 919 ], 920 "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c", 921 "Created": 1365714795, 922 "Size": 131506275, 923 "VirtualSize": 131506275 924 }, 925 { 926 "RepoTags": [ 927 "ubuntu:12.10", 928 "ubuntu:quantal" 929 ], 930 "ParentId": "27cf784147099545", 931 "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", 932 "Created": 1364102658, 933 "Size": 24653, 934 "VirtualSize": 180116135 935 } 936 ] 937 938 939 Query Parameters: 940 941 - **all** – 1/True/true or 0/False/false, default false 942 - **filters** – a json encoded value of the filters (a map[string][]string) to process on the images list. Available filters: 943 - dangling=true 944 - **filter** - only return images with the specified name 945 946 ### Create an image 947 948 `POST /images/create` 949 950 Create an image, either by pulling it from the registry or by importing it 951 952 **Example request**: 953 954 POST /images/create?fromImage=ubuntu HTTP/1.1 955 956 **Example response**: 957 958 HTTP/1.1 200 OK 959 Content-Type: application/json 960 961 {"status": "Pulling..."} 962 {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}} 963 {"error": "Invalid..."} 964 ... 965 966 When using this endpoint to pull an image from the registry, the 967 `X-Registry-Auth` header can be used to include 968 a base64-encoded AuthConfig object. 969 970 Query Parameters: 971 972 - **fromImage** – name of the image to pull 973 - **fromSrc** – source to import. The value may be a URL from which the image 974 can be retrieved or `-` to read the image from the request body. 975 - **repo** – repository 976 - **tag** – tag 977 - **registry** – the registry to pull from 978 979 Request Headers: 980 981 - **X-Registry-Auth** – base64-encoded AuthConfig object 982 983 Status Codes: 984 985 - **200** – no error 986 - **500** – server error 987 988 989 990 ### Inspect an image 991 992 `GET /images/(name)/json` 993 994 Return low-level information on the image `name` 995 996 **Example request**: 997 998 GET /images/ubuntu/json HTTP/1.1 999 1000 **Example response**: 1001 1002 HTTP/1.1 200 OK 1003 Content-Type: application/json 1004 1005 { 1006 "Created": "2013-03-23T22:24:18.818426-07:00", 1007 "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0", 1008 "ContainerConfig": 1009 { 1010 "Hostname": "", 1011 "User": "", 1012 "Memory": 0, 1013 "MemorySwap": 0, 1014 "AttachStdin": false, 1015 "AttachStdout": false, 1016 "AttachStderr": false, 1017 "PortSpecs": null, 1018 "Tty": true, 1019 "OpenStdin": true, 1020 "StdinOnce": false, 1021 "Env": null, 1022 "Cmd": ["/bin/bash"], 1023 "Dns": null, 1024 "Image": "ubuntu", 1025 "Volumes": null, 1026 "VolumesFrom": "", 1027 "WorkingDir": "" 1028 }, 1029 "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", 1030 "Parent": "27cf784147099545", 1031 "Size": 6824592 1032 } 1033 1034 Status Codes: 1035 1036 - **200** – no error 1037 - **404** – no such image 1038 - **500** – server error 1039 1040 ### Get the history of an image 1041 1042 `GET /images/(name)/history` 1043 1044 Return the history of the image `name` 1045 1046 **Example request**: 1047 1048 GET /images/ubuntu/history HTTP/1.1 1049 1050 **Example response**: 1051 1052 HTTP/1.1 200 OK 1053 Content-Type: application/json 1054 1055 [ 1056 { 1057 "Id": "b750fe79269d", 1058 "Created": 1364102658, 1059 "CreatedBy": "/bin/bash" 1060 }, 1061 { 1062 "Id": "27cf78414709", 1063 "Created": 1364068391, 1064 "CreatedBy": "" 1065 } 1066 ] 1067 1068 Status Codes: 1069 1070 - **200** – no error 1071 - **404** – no such image 1072 - **500** – server error 1073 1074 ### Push an image on the registry 1075 1076 `POST /images/(name)/push` 1077 1078 Push the image `name` on the registry 1079 1080 **Example request**: 1081 1082 POST /images/test/push HTTP/1.1 1083 1084 **Example response**: 1085 1086 HTTP/1.1 200 OK 1087 Content-Type: application/json 1088 1089 {"status": "Pushing..."} 1090 {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}} 1091 {"error": "Invalid..."} 1092 ... 1093 1094 If you wish to push an image on to a private registry, that image must already have been tagged 1095 into a repository which references that registry host name and port. This repository name should 1096 then be used in the URL. This mirrors the flow of the CLI. 1097 1098 **Example request**: 1099 1100 POST /images/registry.acme.com:5000/test/push HTTP/1.1 1101 1102 1103 Query Parameters: 1104 1105 - **tag** – the tag to associate with the image on the registry, optional 1106 1107 Request Headers: 1108 1109 - **X-Registry-Auth** – include a base64-encoded AuthConfig 1110 object. 1111 1112 Status Codes: 1113 1114 - **200** – no error 1115 - **404** – no such image 1116 - **500** – server error 1117 1118 ### Tag an image into a repository 1119 1120 `POST /images/(name)/tag` 1121 1122 Tag the image `name` into a repository 1123 1124 **Example request**: 1125 1126 POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1 1127 1128 **Example response**: 1129 1130 HTTP/1.1 201 OK 1131 1132 Query Parameters: 1133 1134 - **repo** – The repository to tag in 1135 - **force** – 1/True/true or 0/False/false, default false 1136 - **tag** - The new tag name 1137 1138 Status Codes: 1139 1140 - **201** – no error 1141 - **400** – bad parameter 1142 - **404** – no such image 1143 - **409** – conflict 1144 - **500** – server error 1145 1146 ### Remove an image 1147 1148 `DELETE /images/(name)` 1149 1150 Remove the image `name` from the filesystem 1151 1152 **Example request**: 1153 1154 DELETE /images/test HTTP/1.1 1155 1156 **Example response**: 1157 1158 HTTP/1.1 200 OK 1159 Content-type: application/json 1160 1161 [ 1162 {"Untagged": "3e2f21a89f"}, 1163 {"Deleted": "3e2f21a89f"}, 1164 {"Deleted": "53b4f83ac9"} 1165 ] 1166 1167 Query Parameters: 1168 1169 - **force** – 1/True/true or 0/False/false, default false 1170 - **noprune** – 1/True/true or 0/False/false, default false 1171 1172 Status Codes: 1173 1174 - **200** – no error 1175 - **404** – no such image 1176 - **409** – conflict 1177 - **500** – server error 1178 1179 ### Search images 1180 1181 `GET /images/search` 1182 1183 Search for an image on [Docker Hub](https://hub.docker.com). 1184 1185 > **Note**: 1186 > The response keys have changed from API v1.6 to reflect the JSON 1187 > sent by the registry server to the docker daemon's request. 1188 1189 **Example request**: 1190 1191 GET /images/search?term=sshd HTTP/1.1 1192 1193 **Example response**: 1194 1195 HTTP/1.1 200 OK 1196 Content-Type: application/json 1197 1198 [ 1199 { 1200 "description": "", 1201 "is_official": false, 1202 "is_automated": false, 1203 "name": "wma55/u1210sshd", 1204 "star_count": 0 1205 }, 1206 { 1207 "description": "", 1208 "is_official": false, 1209 "is_automated": false, 1210 "name": "jdswinbank/sshd", 1211 "star_count": 0 1212 }, 1213 { 1214 "description": "", 1215 "is_official": false, 1216 "is_automated": false, 1217 "name": "vgauthier/sshd", 1218 "star_count": 0 1219 } 1220 ... 1221 ] 1222 1223 Query Parameters: 1224 1225 - **term** – term to search 1226 1227 Status Codes: 1228 1229 - **200** – no error 1230 - **500** – server error 1231 1232 ## 2.3 Misc 1233 1234 ### Build an image from Dockerfile via stdin 1235 1236 `POST /build` 1237 1238 Build an image from Dockerfile via stdin 1239 1240 **Example request**: 1241 1242 POST /build HTTP/1.1 1243 1244 {{ TAR STREAM }} 1245 1246 **Example response**: 1247 1248 HTTP/1.1 200 OK 1249 Content-Type: application/json 1250 1251 {"stream": "Step 1..."} 1252 {"stream": "..."} 1253 {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}} 1254 1255 The stream must be a tar archive compressed with one of the 1256 following algorithms: identity (no compression), gzip, bzip2, xz. 1257 1258 The archive must include a file called `Dockerfile` 1259 at its root. It may include any number of other files, 1260 which will be accessible in the build context (See the [*ADD build 1261 command*](/reference/builder/#dockerbuilder)). 1262 1263 Query Parameters: 1264 1265 - **t** – repository name (and optionally a tag) to be applied to 1266 the resulting image in case of success 1267 - **remote** – git or HTTP/HTTPS URI build source 1268 - **q** – suppress verbose build output 1269 - **nocache** – do not use the cache when building the image 1270 - **rm** - remove intermediate containers after a successful build (default behavior) 1271 - **forcerm** - always remove intermediate containers (includes rm) 1272 1273 Request Headers: 1274 1275 - **Content-type** – should be set to `"application/tar"`. 1276 - **X-Registry-Config** – base64-encoded ConfigFile object 1277 1278 Status Codes: 1279 1280 - **200** – no error 1281 - **500** – server error 1282 1283 ### Check auth configuration 1284 1285 `POST /auth` 1286 1287 Get the default username and email 1288 1289 **Example request**: 1290 1291 POST /auth HTTP/1.1 1292 Content-Type: application/json 1293 1294 { 1295 "username":" hannibal", 1296 "password: "xxxx", 1297 "email": "hannibal@a-team.com", 1298 "serveraddress": "https://index.docker.io/v1/" 1299 } 1300 1301 **Example response**: 1302 1303 HTTP/1.1 200 OK 1304 1305 Status Codes: 1306 1307 - **200** – no error 1308 - **204** – no error 1309 - **500** – server error 1310 1311 ### Display system-wide information 1312 1313 `GET /info` 1314 1315 Display system-wide information 1316 1317 **Example request**: 1318 1319 GET /info HTTP/1.1 1320 1321 **Example response**: 1322 1323 HTTP/1.1 200 OK 1324 Content-Type: application/json 1325 1326 { 1327 "Containers": 11, 1328 "Images": 16, 1329 "Driver": "btrfs", 1330 "ExecutionDriver": "native-0.1", 1331 "KernelVersion": "3.12.0-1-amd64" 1332 "Debug": false, 1333 "NFd": 11, 1334 "NGoroutines": 21, 1335 "NEventsListener": 0, 1336 "InitPath": "/usr/bin/docker", 1337 "IndexServerAddress": ["https://index.docker.io/v1/"], 1338 "MemoryLimit": true, 1339 "SwapLimit": false, 1340 "IPv4Forwarding": true 1341 } 1342 1343 Status Codes: 1344 1345 - **200** – no error 1346 - **500** – server error 1347 1348 ### Show the docker version information 1349 1350 `GET /version` 1351 1352 Show the docker version information 1353 1354 **Example request**: 1355 1356 GET /version HTTP/1.1 1357 1358 **Example response**: 1359 1360 HTTP/1.1 200 OK 1361 Content-Type: application/json 1362 1363 { 1364 "ApiVersion": "1.12", 1365 "Version": "0.2.2", 1366 "GitCommit": "5a2a5cc+CHANGES", 1367 "GoVersion": "go1.0.3" 1368 } 1369 1370 Status Codes: 1371 1372 - **200** – no error 1373 - **500** – server error 1374 1375 ### Ping the docker server 1376 1377 `GET /_ping` 1378 1379 Ping the docker server 1380 1381 **Example request**: 1382 1383 GET /_ping HTTP/1.1 1384 1385 **Example response**: 1386 1387 HTTP/1.1 200 OK 1388 Content-Type: text/plain 1389 1390 OK 1391 1392 Status Codes: 1393 1394 - **200** - no error 1395 - **500** - server error 1396 1397 ### Create a new image from a container's changes 1398 1399 `POST /commit` 1400 1401 Create a new image from a container's changes 1402 1403 **Example request**: 1404 1405 POST /commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1 1406 Content-Type: application/json 1407 1408 { 1409 "Hostname": "", 1410 "Domainname": "", 1411 "User": "", 1412 "Memory": 0, 1413 "MemorySwap": 0, 1414 "CpuShares": 512, 1415 "Cpuset": "0,1", 1416 "AttachStdin": false, 1417 "AttachStdout": true, 1418 "AttachStderr": true, 1419 "PortSpecs": null, 1420 "Tty": false, 1421 "OpenStdin": false, 1422 "StdinOnce": false, 1423 "Env": null, 1424 "Cmd": [ 1425 "date" 1426 ], 1427 "Volumes": { 1428 "/tmp": {} 1429 }, 1430 "WorkingDir": "", 1431 "NetworkDisabled": false, 1432 "ExposedPorts": { 1433 "22/tcp": {} 1434 } 1435 } 1436 1437 **Example response**: 1438 1439 HTTP/1.1 201 Created 1440 Content-Type: application/vnd.docker.raw-stream 1441 1442 {"Id": "596069db4bf5"} 1443 1444 Json Parameters: 1445 1446 - **config** - the container's configuration 1447 1448 Query Parameters: 1449 1450 - **container** – source container 1451 - **repo** – repository 1452 - **tag** – tag 1453 - **comment** – commit message 1454 - **author** – author (e.g., "John Hannibal Smith 1455 <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>") 1456 1457 Status Codes: 1458 1459 - **201** – no error 1460 - **404** – no such container 1461 - **500** – server error 1462 1463 ### Monitor Docker's events 1464 1465 `GET /events` 1466 1467 Get container events from docker, either in real time via streaming, or via 1468 polling (using since). 1469 1470 Docker containers will report the following events: 1471 1472 create, destroy, die, export, kill, pause, restart, start, stop, unpause 1473 1474 and Docker images will report: 1475 1476 untag, delete 1477 1478 **Example request**: 1479 1480 GET /events?since=1374067924 1481 1482 **Example response**: 1483 1484 HTTP/1.1 200 OK 1485 Content-Type: application/json 1486 1487 {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} 1488 {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924} 1489 {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966} 1490 {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970} 1491 1492 Query Parameters: 1493 1494 - **since** – timestamp used for polling 1495 - **until** – timestamp used for polling 1496 1497 Status Codes: 1498 1499 - **200** – no error 1500 - **500** – server error 1501 1502 ### Get a tarball containing all images in a repository 1503 1504 `GET /images/(name)/get` 1505 1506 Get a tarball containing all images and metadata for the repository specified 1507 by `name`. 1508 1509 If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image 1510 (and its parents) are returned. If `name` is an image ID, similarly only that 1511 image (and its parents) are returned, but with the exclusion of the 1512 'repositories' file in the tarball, as there were no image names referenced. 1513 1514 See the [image tarball format](#image-tarball-format) for more details. 1515 1516 **Example request** 1517 1518 GET /images/ubuntu/get 1519 1520 **Example response**: 1521 1522 HTTP/1.1 200 OK 1523 Content-Type: application/x-tar 1524 1525 Binary data stream 1526 1527 Status Codes: 1528 1529 - **200** – no error 1530 - **500** – server error 1531 1532 ### Get a tarball containing all images. 1533 1534 `GET /images/get` 1535 1536 Get a tarball containing all images and metadata for one or more repositories. 1537 1538 For each value of the `names` parameter: if it is a specific name and tag (e.g. 1539 ubuntu:latest), then only that image (and its parents) are returned; if it is 1540 an image ID, similarly only that image (and its parents) are returned and there 1541 would be no names referenced in the 'repositories' file for this image ID. 1542 1543 See the [image tarball format](#image-tarball-format) for more details. 1544 1545 **Example request** 1546 1547 GET /images/get?names=myname%2Fmyapp%3Alatest&names=busybox 1548 1549 **Example response**: 1550 1551 HTTP/1.1 200 OK 1552 Content-Type: application/x-tar 1553 1554 Binary data stream 1555 1556 Status Codes: 1557 1558 - **200** – no error 1559 - **500** – server error 1560 1561 ### Load a tarball with a set of images and tags into docker 1562 1563 `POST /images/load` 1564 1565 Load a set of images and tags into the docker repository. 1566 See the [image tarball format](#image-tarball-format) for more details. 1567 1568 **Example request** 1569 1570 POST /images/load 1571 1572 Tarball in body 1573 1574 **Example response**: 1575 1576 HTTP/1.1 200 OK 1577 1578 Status Codes: 1579 1580 - **200** – no error 1581 - **500** – server error 1582 1583 ### Image tarball format 1584 1585 An image tarball contains one directory per image layer (named using its long ID), 1586 each containing three files: 1587 1588 1. `VERSION`: currently `1.0` - the file format version 1589 2. `json`: detailed layer information, similar to `docker inspect layer_id` 1590 3. `layer.tar`: A tarfile containing the filesystem changes in this layer 1591 1592 The `layer.tar` file will contain `aufs` style `.wh..wh.aufs` files and directories 1593 for storing attribute changes and deletions. 1594 1595 If the tarball defines a repository, there will also be a `repositories` file at 1596 the root that contains a list of repository and tag names mapped to layer IDs. 1597 1598 ``` 1599 {"hello-world": 1600 {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"} 1601 } 1602 ``` 1603 1604 ### Exec Create 1605 1606 `POST /containers/(id)/exec` 1607 1608 Sets up an exec instance in a running container `id` 1609 1610 **Example request**: 1611 1612 POST /containers/e90e34656806/exec HTTP/1.1 1613 Content-Type: application/json 1614 1615 { 1616 "AttachStdin": false, 1617 "AttachStdout": true, 1618 "AttachStderr": true, 1619 "Tty": false, 1620 "Cmd": [ 1621 "date" 1622 ], 1623 } 1624 1625 **Example response**: 1626 1627 HTTP/1.1 201 OK 1628 Content-Type: application/json 1629 1630 { 1631 "Id": "f90e34656806" 1632 } 1633 1634 Json Parameters: 1635 1636 - **AttachStdin** - Boolean value, attaches to stdin of the exec command. 1637 - **AttachStdout** - Boolean value, attaches to stdout of the exec command. 1638 - **AttachStderr** - Boolean value, attaches to stderr of the exec command. 1639 - **Tty** - Boolean value to allocate a pseudo-TTY 1640 - **Cmd** - Command to run specified as a string or an array of strings. 1641 1642 1643 Status Codes: 1644 1645 - **201** – no error 1646 - **404** – no such container 1647 1648 ### Exec Start 1649 1650 `POST /exec/(id)/start` 1651 1652 Starts a previously set up exec instance `id`. If `detach` is true, this API 1653 returns after starting the `exec` command. Otherwise, this API sets up an 1654 interactive session with the `exec` command. 1655 1656 **Example request**: 1657 1658 POST /exec/e90e34656806/start HTTP/1.1 1659 Content-Type: application/json 1660 1661 { 1662 "Detach": false, 1663 "Tty": false, 1664 } 1665 1666 **Example response**: 1667 1668 HTTP/1.1 201 OK 1669 Content-Type: application/json 1670 1671 {{ STREAM }} 1672 1673 Json Parameters: 1674 1675 - **Detach** - Detach from the exec command 1676 - **Tty** - Boolean value to allocate a pseudo-TTY 1677 1678 Status Codes: 1679 1680 - **201** – no error 1681 - **404** – no such exec instance 1682 1683 **Stream details**: 1684 Similar to the stream behavior of `POST /container/(id)/attach` API 1685 1686 ### Exec Resize 1687 1688 `POST /exec/(id)/resize` 1689 1690 Resizes the tty session used by the exec command `id`. 1691 This API is valid only if `tty` was specified as part of creating and starting the exec command. 1692 1693 **Example request**: 1694 1695 POST /exec/e90e34656806/resize HTTP/1.1 1696 Content-Type: plain/text 1697 1698 **Example response**: 1699 1700 HTTP/1.1 201 OK 1701 Content-Type: plain/text 1702 1703 Query Parameters: 1704 1705 - **h** – height of tty session 1706 - **w** – width 1707 1708 Status Codes: 1709 1710 - **201** – no error 1711 - **404** – no such exec instance 1712 1713 # 3. Going further 1714 1715 ## 3.1 Inside `docker run` 1716 1717 As an example, the `docker run` command line makes the following API calls: 1718 1719 - Create the container 1720 1721 - If the status code is 404, it means the image doesn't exist: 1722 - Try to pull it 1723 - Then retry to create the container 1724 1725 - Start the container 1726 1727 - If you are not in detached mode: 1728 - Attach to the container, using logs=1 (to have stdout and 1729 stderr from the container's start) and stream=1 1730 1731 - If in detached mode or only stdin is attached: 1732 - Display the container's id 1733 1734 ## 3.2 Hijacking 1735 1736 In this version of the API, /attach, uses hijacking to transport stdin, 1737 stdout and stderr on the same socket. This might change in the future. 1738 1739 ## 3.3 CORS Requests 1740 1741 To enable cross origin requests to the remote api add the flag 1742 "--api-enable-cors" when running docker in daemon mode. 1743 1744 $ docker -d -H="192.168.1.9:2375" --api-enable-cors