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