github.com/daaku/docker@v1.5.0/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&timestamps=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  -   **remote** – git or HTTP/HTTPS URI build source
  1256  -   **q** – suppress verbose build output
  1257  -   **nocache** – do not use the cache when building the image
  1258  -   **rm** - remove intermediate containers after a successful build (default behavior)
  1259  -   **forcerm** - always remove intermediate containers (includes rm)
  1260  
  1261      Request Headers:
  1262  
  1263  -   **Content-type** – should be set to `"application/tar"`.
  1264  -   **X-Registry-Config** – base64-encoded ConfigFile objec
  1265  
  1266  Status Codes:
  1267  
  1268  -   **200** – no error
  1269  -   **500** – server error
  1270  
  1271  ### Check auth configuration
  1272  
  1273  `POST /auth`
  1274  
  1275  Get the default username and email
  1276  
  1277  **Example request**:
  1278  
  1279          POST /auth HTTP/1.1
  1280          Content-Type: application/json
  1281  
  1282          {
  1283               "username":" hannibal",
  1284               "password: "xxxx",
  1285               "email": "hannibal@a-team.com",
  1286               "serveraddress": "https://index.docker.io/v1/"
  1287          }
  1288  
  1289  **Example response**:
  1290  
  1291          HTTP/1.1 200 OK
  1292  
  1293  Status Codes:
  1294  
  1295  -   **200** – no error
  1296  -   **204** – no error
  1297  -   **500** – server error
  1298  
  1299  ### Display system-wide information
  1300  
  1301  `GET /info`
  1302  
  1303  Display system-wide information
  1304  
  1305  **Example request**:
  1306  
  1307          GET /info HTTP/1.1
  1308  
  1309  **Example response**:
  1310  
  1311          HTTP/1.1 200 OK
  1312          Content-Type: application/json
  1313  
  1314          {
  1315               "Containers": 11,
  1316               "Images": 16,
  1317               "Driver": "btrfs",
  1318               "ExecutionDriver": "native-0.1",
  1319               "KernelVersion": "3.12.0-1-amd64"
  1320               "Debug": false,
  1321               "NFd": 11,
  1322               "NGoroutines": 21,
  1323               "NEventsListener": 0,
  1324               "InitPath": "/usr/bin/docker",
  1325               "IndexServerAddress": ["https://index.docker.io/v1/"],
  1326               "MemoryLimit": true,
  1327               "SwapLimit": false,
  1328               "IPv4Forwarding": true
  1329          }
  1330  
  1331  Status Codes:
  1332  
  1333  -   **200** – no error
  1334  -   **500** – server error
  1335  
  1336  ### Show the docker version information
  1337  
  1338  `GET /version`
  1339  
  1340  Show the docker version information
  1341  
  1342  **Example request**:
  1343  
  1344          GET /version HTTP/1.1
  1345  
  1346  **Example response**:
  1347  
  1348          HTTP/1.1 200 OK
  1349          Content-Type: application/json
  1350  
  1351          {
  1352               "ApiVersion": "1.12",
  1353               "Version": "0.2.2",
  1354               "GitCommit": "5a2a5cc+CHANGES",
  1355               "GoVersion": "go1.0.3"
  1356          }
  1357  
  1358  Status Codes:
  1359  
  1360  -   **200** – no error
  1361  -   **500** – server error
  1362  
  1363  ### Ping the docker server
  1364  
  1365  `GET /_ping`
  1366  
  1367  Ping the docker server
  1368  
  1369  **Example request**:
  1370  
  1371          GET /_ping HTTP/1.1
  1372  
  1373  **Example response**:
  1374  
  1375          HTTP/1.1 200 OK
  1376          Content-Type: text/plain
  1377  
  1378          OK
  1379  
  1380  Status Codes:
  1381  
  1382  -   **200** - no error
  1383  -   **500** - server error
  1384  
  1385  ### Create a new image from a container's changes
  1386  
  1387  `POST /commit`
  1388  
  1389  Create a new image from a container's changes
  1390  
  1391  **Example request**:
  1392  
  1393          POST /commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
  1394          Content-Type: application/json
  1395  
  1396          {
  1397               "Hostname": "",
  1398               "Domainname": "",
  1399               "User": "",
  1400               "Memory": 0,
  1401               "MemorySwap": 0,
  1402               "CpuShares": 512,
  1403               "Cpuset": "0,1",
  1404               "AttachStdin": false,
  1405               "AttachStdout": true,
  1406               "AttachStderr": true,
  1407               "PortSpecs": null,
  1408               "Tty": false,
  1409               "OpenStdin": false,
  1410               "StdinOnce": false,
  1411               "Env": null,
  1412               "Cmd": [
  1413                       "date"
  1414               ],
  1415               "Volumes": {
  1416                       "/tmp": {}
  1417               },
  1418               "WorkingDir": "",
  1419               "NetworkDisabled": false,
  1420               "ExposedPorts": {
  1421                       "22/tcp": {}
  1422               }
  1423          }
  1424  
  1425  **Example response**:
  1426  
  1427          HTTP/1.1 201 Created
  1428          Content-Type: application/vnd.docker.raw-stream
  1429  
  1430          {"Id": "596069db4bf5"}
  1431  
  1432  Json Parameters:
  1433  
  1434  -  **config** - the container's configuration
  1435  
  1436  Query Parameters:
  1437  
  1438  -   **container** – source container
  1439  -   **repo** – repository
  1440  -   **tag** – tag
  1441  -   **comment** – commit message
  1442  -   **author** – author (e.g., "John Hannibal Smith
  1443      <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
  1444  
  1445  Status Codes:
  1446  
  1447  -   **201** – no error
  1448  -   **404** – no such container
  1449  -   **500** – server error
  1450  
  1451  ### Monitor Docker's events
  1452  
  1453  `GET /events`
  1454  
  1455  Get container events from docker, either in real time via streaming, or via
  1456  polling (using since).
  1457  
  1458  Docker containers will report the following events:
  1459  
  1460      create, destroy, die, export, kill, pause, restart, start, stop, unpause
  1461  
  1462  and Docker images will report:
  1463  
  1464      untag, delete
  1465  
  1466  **Example request**:
  1467  
  1468          GET /events?since=1374067924
  1469  
  1470  **Example response**:
  1471  
  1472          HTTP/1.1 200 OK
  1473          Content-Type: application/json
  1474  
  1475          {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
  1476          {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
  1477          {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966}
  1478          {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970}
  1479  
  1480  Query Parameters:
  1481  
  1482  -   **since** – timestamp used for polling
  1483  -   **until** – timestamp used for polling
  1484  
  1485  Status Codes:
  1486  
  1487  -   **200** – no error
  1488  -   **500** – server error
  1489  
  1490  ### Get a tarball containing all images in a repository
  1491  
  1492  `GET /images/(name)/get`
  1493  
  1494  Get a tarball containing all images and metadata for the repository specified
  1495  by `name`.
  1496  
  1497  If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
  1498  (and its parents) are returned. If `name` is an image ID, similarly only tha
  1499  image (and its parents) are returned, but with the exclusion of the
  1500  'repositories' file in the tarball, as there were no image names referenced.
  1501  
  1502  See the [image tarball format](#image-tarball-format) for more details.
  1503  
  1504  **Example request**
  1505  
  1506          GET /images/ubuntu/get
  1507  
  1508  **Example response**:
  1509  
  1510          HTTP/1.1 200 OK
  1511          Content-Type: application/x-tar
  1512  
  1513          Binary data stream
  1514  
  1515  Status Codes:
  1516  
  1517  -   **200** – no error
  1518  -   **500** – server error
  1519  
  1520  ### Get a tarball containing all images.
  1521  
  1522  `GET /images/get`
  1523  
  1524  Get a tarball containing all images and metadata for one or more repositories.
  1525  
  1526  For each value of the `names` parameter: if it is a specific name and tag (e.g.
  1527  ubuntu:latest), then only that image (and its parents) are returned; if it is
  1528  an image ID, similarly only that image (and its parents) are returned and there
  1529  would be no names referenced in the 'repositories' file for this image ID.
  1530  
  1531  See the [image tarball format](#image-tarball-format) for more details.
  1532  
  1533  **Example request**
  1534  
  1535          GET /images/get?names=myname%2Fmyapp%3Alatest&names=busybox
  1536  
  1537  **Example response**:
  1538  
  1539          HTTP/1.1 200 OK
  1540          Content-Type: application/x-tar
  1541  
  1542          Binary data stream
  1543  
  1544  Status Codes:
  1545  
  1546  -   **200** – no error
  1547  -   **500** – server error
  1548  
  1549  ### Load a tarball with a set of images and tags into docker
  1550  
  1551  `POST /images/load`
  1552  
  1553  Load a set of images and tags into the docker repository.
  1554  See the [image tarball format](#image-tarball-format) for more details.
  1555  
  1556  **Example request**
  1557  
  1558          POST /images/load
  1559  
  1560          Tarball in body
  1561  
  1562  **Example response**:
  1563  
  1564          HTTP/1.1 200 OK
  1565  
  1566  Status Codes:
  1567  
  1568  -   **200** – no error
  1569  -   **500** – server error
  1570  
  1571  ### Image tarball format
  1572  
  1573  An image tarball contains one directory per image layer (named using its long ID),
  1574  each containing three files:
  1575  
  1576  1. `VERSION`: currently `1.0` - the file format version
  1577  2. `json`: detailed layer information, similar to `docker inspect layer_id`
  1578  3. `layer.tar`: A tarfile containing the filesystem changes in this layer
  1579  
  1580  The `layer.tar` file will contain `aufs` style `.wh..wh.aufs` files and directories
  1581  for storing attribute changes and deletions.
  1582  
  1583  If the tarball defines a repository, there will also be a `repositories` file at
  1584  the root that contains a list of repository and tag names mapped to layer IDs.
  1585  
  1586  ```
  1587  {"hello-world":
  1588      {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
  1589  }
  1590  ```
  1591  
  1592  ### Exec Create
  1593  
  1594  `POST /containers/(id)/exec`
  1595  
  1596  Sets up an exec instance in a running container `id`
  1597  
  1598  **Example request**:
  1599  
  1600          POST /containers/e90e34656806/exec HTTP/1.1
  1601          Content-Type: application/json
  1602  
  1603          {
  1604  	     "AttachStdin": false,
  1605  	     "AttachStdout": true,
  1606  	     "AttachStderr": true,
  1607  	     "Tty": false,
  1608  	     "Cmd": [
  1609                       "date"
  1610               ],
  1611          }
  1612  
  1613  **Example response**:
  1614  
  1615          HTTP/1.1 201 OK
  1616          Content-Type: application/json
  1617  
  1618          {
  1619               "Id": "f90e34656806"
  1620          }
  1621  
  1622  Json Parameters:
  1623  
  1624  -   **AttachStdin** - Boolean value, attaches to stdin of the exec command.
  1625  -   **AttachStdout** - Boolean value, attaches to stdout of the exec command.
  1626  -   **AttachStderr** - Boolean value, attaches to stderr of the exec command.
  1627  -   **Tty** - Boolean value to allocate a pseudo-TTY
  1628  -   **Cmd** - Command to run specified as a string or an array of strings.
  1629  
  1630  
  1631  Status Codes:
  1632  
  1633  -   **201** – no error
  1634  -   **404** – no such container
  1635  
  1636  ### Exec Start
  1637  
  1638  `POST /exec/(id)/start`
  1639  
  1640  Starts a previously set up exec instance `id`. If `detach` is true, this API
  1641  returns after starting the `exec` command. Otherwise, this API sets up an
  1642  interactive session with the `exec` command.
  1643  
  1644  **Example request**:
  1645  
  1646          POST /exec/e90e34656806/start HTTP/1.1
  1647          Content-Type: application/json
  1648  
  1649          {
  1650  	     "Detach": false,
  1651  	     "Tty": false,
  1652          }
  1653  
  1654  **Example response**:
  1655  
  1656          HTTP/1.1 201 OK
  1657          Content-Type: application/json
  1658  
  1659          {{ STREAM }}
  1660  
  1661  Json Parameters:
  1662  
  1663  -   **Detach** - Detach from the exec command
  1664  -   **Tty** - Boolean value to allocate a pseudo-TTY
  1665  
  1666  Status Codes:
  1667  
  1668  -   **201** – no error
  1669  -   **404** – no such exec instance
  1670  
  1671      **Stream details**:
  1672      Similar to the stream behavior of `POST /container/(id)/attach` API
  1673  
  1674  ### Exec Resize
  1675  
  1676  `POST /exec/(id)/resize`
  1677  
  1678  Resizes the tty session used by the exec command `id`.
  1679  This API is valid only if `tty` was specified as part of creating and starting the exec command.
  1680  
  1681  **Example request**:
  1682  
  1683          POST /exec/e90e34656806/resize HTTP/1.1
  1684          Content-Type: plain/text
  1685  
  1686  **Example response**:
  1687  
  1688          HTTP/1.1 201 OK
  1689          Content-Type: plain/text
  1690  
  1691  Query Parameters:
  1692  
  1693  -   **h** – height of tty session
  1694  -   **w** – width
  1695  
  1696  Status Codes:
  1697  
  1698  -   **201** – no error
  1699  -   **404** – no such exec instance
  1700  
  1701  # 3. Going further
  1702  
  1703  ## 3.1 Inside `docker run`
  1704  
  1705  As an example, the `docker run` command line makes the following API calls:
  1706  
  1707  - Create the container
  1708  
  1709  - If the status code is 404, it means the image doesn't exist:
  1710      - Try to pull it
  1711      - Then retry to create the container
  1712  
  1713  - Start the container
  1714  
  1715  - If you are not in detached mode:
  1716  - Attach to the container, using logs=1 (to have stdout and
  1717        stderr from the container's start) and stream=1
  1718  
  1719  - If in detached mode or only stdin is attached:
  1720  - Display the container's id
  1721  
  1722  ## 3.2 Hijacking
  1723  
  1724  In this version of the API, /attach, uses hijacking to transport stdin,
  1725  stdout and stderr on the same socket. This might change in the future.
  1726  
  1727  ## 3.3 CORS Requests
  1728  
  1729  To enable cross origin requests to the remote api add the flag
  1730  "--api-enable-cors" when running docker in daemon mode.
  1731  
  1732      $ docker -d -H="192.168.1.9:2375" --api-enable-cors