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