github.com/endocode/docker@v1.4.2-0.20160113120958-46eb4700391e/docs/reference/api/docker_remote_api_v1.19.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Remote API v1.19"
     4  description = "API Documentation for Docker"
     5  keywords = ["API, Docker, rcli, REST,  documentation"]
     6  [menu.main]
     7  parent = "smn_remoteapi"
     8  weight = 2
     9  +++
    10  <![end-metadata]-->
    11  
    12  # Docker Remote API v1.19
    13  
    14  ## 1. Brief introduction
    15  
    16   - The Remote API has replaced `rcli`.
    17   - The daemon listens on `unix:///var/run/docker.sock` but you can
    18     [Bind Docker to another host/port or a Unix socket](../../userguide/basics.md#bind-docker-to-another-host-port-or-a-unix-socket).
    19   - The API tends to be REST. However, for some complex commands, like `attach`
    20     or `pull`, the HTTP connection is hijacked to transport `stdout`,
    21     `stdin` and `stderr`.
    22   - When the client API version is newer than the daemon's, these calls return an HTTP
    23     `400 Bad Request` error message.
    24  
    25  # 2. Endpoints
    26  
    27  ## 2.1 Containers
    28  
    29  ### List containers
    30  
    31  `GET /containers/json`
    32  
    33  List containers
    34  
    35  **Example request**:
    36  
    37      GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
    38  
    39  **Example response**:
    40  
    41      HTTP/1.1 200 OK
    42      Content-Type: application/json
    43  
    44      [
    45           {
    46                   "Id": "8dfafdbc3a40",
    47                   "Names":["/boring_feynman"],
    48                   "Image": "ubuntu:latest",
    49                   "Command": "echo 1",
    50                   "Created": 1367854155,
    51                   "Status": "Exit 0",
    52                   "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
    53                   "Labels": {
    54                           "com.example.vendor": "Acme",
    55                           "com.example.license": "GPL",
    56                           "com.example.version": "1.0"
    57                   },
    58                   "SizeRw": 12288,
    59                   "SizeRootFs": 0
    60           },
    61           {
    62                   "Id": "9cd87474be90",
    63                   "Names":["/coolName"],
    64                   "Image": "ubuntu:latest",
    65                   "Command": "echo 222222",
    66                   "Created": 1367854155,
    67                   "Status": "Exit 0",
    68                   "Ports": [],
    69                   "Labels": {},
    70                   "SizeRw": 12288,
    71                   "SizeRootFs": 0
    72           },
    73           {
    74                   "Id": "3176a2479c92",
    75                   "Names":["/sleepy_dog"],
    76                   "Image": "ubuntu:latest",
    77                   "Command": "echo 3333333333333333",
    78                   "Created": 1367854154,
    79                   "Status": "Exit 0",
    80                   "Ports":[],
    81                   "Labels": {},
    82                   "SizeRw":12288,
    83                   "SizeRootFs":0
    84           },
    85           {
    86                   "Id": "4cb07b47f9fb",
    87                   "Names":["/running_cat"],
    88                   "Image": "ubuntu:latest",
    89                   "Command": "echo 444444444444444444444444444444444",
    90                   "Created": 1367854152,
    91                   "Status": "Exit 0",
    92                   "Ports": [],
    93                   "Labels": {},
    94                   "SizeRw": 12288,
    95                   "SizeRootFs": 0
    96           }
    97      ]
    98  
    99  Query Parameters:
   100  
   101  -   **all** – 1/True/true or 0/False/false, Show all containers.
   102          Only running containers are shown by default (i.e., this defaults to false)
   103  -   **limit** – Show `limit` last created
   104          containers, include non-running ones.
   105  -   **since** – Show only containers created since Id, include
   106          non-running ones.
   107  -   **before** – Show only containers created before Id, include
   108          non-running ones.
   109  -   **size** – 1/True/true or 0/False/false, Show the containers
   110          sizes
   111  -   **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
   112    -   `exited=<int>`; -- containers with exit code of  `<int>` ;
   113    -   `status=`(`restarting`|`running`|`paused`|`exited`)
   114    -   `label=key` or `label="key=value"` of a container label
   115  
   116  Status Codes:
   117  
   118  -   **200** – no error
   119  -   **400** – bad parameter
   120  -   **500** – server error
   121  
   122  ### Create a container
   123  
   124  `POST /containers/create`
   125  
   126  Create a container
   127  
   128  **Example request**:
   129  
   130      POST /containers/create HTTP/1.1
   131      Content-Type: application/json
   132  
   133      {
   134             "Hostname": "",
   135             "Domainname": "",
   136             "User": "",
   137             "AttachStdin": false,
   138             "AttachStdout": true,
   139             "AttachStderr": true,
   140             "Tty": false,
   141             "OpenStdin": false,
   142             "StdinOnce": false,
   143             "Env": [
   144                     "FOO=bar",
   145                     "BAZ=quux"
   146             ],
   147             "Cmd": [
   148                     "date"
   149             ],
   150             "Entrypoint": "",
   151             "Image": "ubuntu",
   152             "Labels": {
   153                     "com.example.vendor": "Acme",
   154                     "com.example.license": "GPL",
   155                     "com.example.version": "1.0"
   156             },
   157             "Volumes": {
   158                     "/tmp": {}
   159             },
   160             "WorkingDir": "",
   161             "NetworkDisabled": false,
   162             "MacAddress": "12:34:56:78:9a:bc",
   163             "ExposedPorts": {
   164                     "22/tcp": {}
   165             },
   166             "HostConfig": {
   167               "Binds": ["/tmp:/tmp"],
   168               "Links": ["redis3:redis"],
   169               "LxcConf": {"lxc.utsname":"docker"},
   170               "Memory": 0,
   171               "MemorySwap": 0,
   172               "CpuShares": 512,
   173               "CpuPeriod": 100000,
   174               "CpuQuota": 50000,
   175               "CpusetCpus": "0,1",
   176               "CpusetMems": "0,1",
   177               "BlkioWeight": 300,
   178               "OomKillDisable": false,
   179               "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
   180               "PublishAllPorts": false,
   181               "Privileged": false,
   182               "ReadonlyRootfs": false,
   183               "Dns": ["8.8.8.8"],
   184               "DnsSearch": [""],
   185               "ExtraHosts": null,
   186               "VolumesFrom": ["parent", "other:ro"],
   187               "CapAdd": ["NET_ADMIN"],
   188               "CapDrop": ["MKNOD"],
   189               "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
   190               "NetworkMode": "bridge",
   191               "Devices": [],
   192               "Ulimits": [{}],
   193               "LogConfig": { "Type": "json-file", "Config": {} },
   194               "SecurityOpt": [""],
   195               "CgroupParent": ""
   196            }
   197        }
   198  
   199  **Example response**:
   200  
   201        HTTP/1.1 201 Created
   202        Content-Type: application/json
   203  
   204        {
   205             "Id":"e90e34656806",
   206             "Warnings":[]
   207        }
   208  
   209  Json Parameters:
   210  
   211  -   **Hostname** - A string value containing the hostname to use for the
   212        container.
   213  -   **Domainname** - A string value containing the domain name to use
   214        for the container.
   215  -   **User** - A string value specifying the user inside the container.
   216  -   **Memory** - Memory limit in bytes.
   217  -   **MemorySwap**- Total memory limit (memory + swap); set `-1` to disable swap
   218        You must use this with `memory` and make the swap value larger than `memory`.
   219  -   **CpuShares** - An integer value containing the container's CPU Shares
   220        (ie. the relative weight vs other containers).
   221  -   **CpuPeriod** - The length of a CPU period in microseconds.
   222  -   **CpuQuota** - Microseconds of CPU time that the container can get in a CPU period.
   223  -   **Cpuset** - Deprecated please don't use. Use `CpusetCpus` instead. 
   224  -   **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
   225  -   **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
   226  -   **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
   227  -   **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
   228  -   **AttachStdin** - Boolean value, attaches to `stdin`.
   229  -   **AttachStdout** - Boolean value, attaches to `stdout`.
   230  -   **AttachStderr** - Boolean value, attaches to `stderr`.
   231  -   **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
   232  -   **OpenStdin** - Boolean value, opens stdin,
   233  -   **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
   234  -   **Env** - A list of environment variables in the form of `["VAR=value"[,"VAR2=value2"]]`
   235  -   **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value"[,"key2":"value2"]}`
   236  -   **Cmd** - Command to run specified as a string or an array of strings.
   237  -   **Entrypoint** - Set the entry point for the container as a string or an array
   238        of strings.
   239  -   **Image** - A string specifying the image name to use for the container.
   240  -   **Volumes** – An object mapping mount point paths (strings) inside the
   241        container to empty objects.
   242  -   **WorkingDir** - A string specifying the working directory for commands to
   243        run in.
   244  -   **NetworkDisabled** - Boolean value, when true disables networking for the
   245        container
   246  -   **ExposedPorts** - An object mapping ports to an empty object in the form of:
   247        `"ExposedPorts": { "<port>/<tcp|udp>: {}" }`
   248  -   **HostConfig**
   249      -   **Binds** – A list of volume bindings for this container. Each volume binding is a string in one of these forms:
   250             + `container_path` to create a new volume for the container
   251             + `host_path:container_path` to bind-mount a host path into the container
   252             + `host_path:container_path:ro` to make the bind-mount read-only inside the container.
   253      -   **Links** - A list of links for the container. Each link entry should be
   254            in the form of `container_name:alias`.
   255      -   **LxcConf** - LXC specific configurations. These configurations only
   256            work when using the `lxc` execution driver.
   257      -   **PortBindings** - A map of exposed container ports and the host port they
   258            should map to. A JSON object in the form
   259            `{ <port>/<protocol>: [{ "HostPort": "<port>" }] }`
   260            Take note that `port` is specified as a string and not an integer value.
   261      -   **PublishAllPorts** - Allocates a random host port for all of a container's
   262            exposed ports. Specified as a boolean value.
   263      -   **Privileged** - Gives the container full access to the host. Specified as
   264            a boolean value.
   265      -   **ReadonlyRootfs** - Mount the container's root filesystem as read only.
   266            Specified as a boolean value.
   267      -   **Dns** - A list of DNS servers for the container to use.
   268      -   **DnsSearch** - A list of DNS search domains
   269      -   **ExtraHosts** - A list of hostnames/IP mappings to add to the
   270          container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
   271      -   **VolumesFrom** - A list of volumes to inherit from another container.
   272            Specified in the form `<container name>[:<ro|rw>]`
   273      -   **CapAdd** - A list of kernel capabilities to add to the container.
   274      -   **Capdrop** - A list of kernel capabilities to drop from the container.
   275      -   **RestartPolicy** – The behavior to apply when the container exits.  The
   276              value is an object with a `Name` property of either `"always"` to
   277              always restart or `"on-failure"` to restart only when the container
   278              exit code is non-zero.  If `on-failure` is used, `MaximumRetryCount`
   279              controls the number of times to retry before giving up.
   280              The default is not to restart. (optional)
   281              An ever increasing delay (double the previous delay, starting at 100mS)
   282              is added before each restart to prevent flooding the server.
   283      -   **NetworkMode** - Sets the networking mode for the container. Supported
   284            values are: `bridge`, `host`, and `container:<name|id>`
   285      -   **Devices** - A list of devices to add to the container specified as a JSON object in the
   286        form
   287            `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
   288      -   **Ulimits** - A list of ulimits to set in the container, specified as
   289            `{ "Name": <name>, "Soft": <soft limit>, "Hard": <hard limit> }`, for example:
   290            `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
   291      -   **SecurityOpt**: A list of string values to customize labels for MLS
   292          systems, such as SELinux.
   293      -   **LogConfig** - Log configuration for the container, specified as a JSON object in the form
   294            `{ "Type": "<driver_name>", "Config": {"key1": "val1"}}`.
   295            Available types: `json-file`, `syslog`, `journald`, `none`.
   296  	      `syslog` available options are: `address`.
   297      -   **CgroupParent** - Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist.
   298  
   299  Query Parameters:
   300  
   301  -   **name** – Assign the specified name to the container. Must
   302      match `/?[a-zA-Z0-9_-]+`.
   303  
   304  Status Codes:
   305  
   306  -   **201** – no error
   307  -   **404** – no such container
   308  -   **406** – impossible to attach (container not running)
   309  -   **500** – server error
   310  
   311  ### Inspect a container
   312  
   313  `GET /containers/(id)/json`
   314  
   315  Return low-level information on the container `id`
   316  
   317  
   318  **Example request**:
   319  
   320        GET /containers/4fa6e0f0c678/json HTTP/1.1
   321  
   322  **Example response**:
   323  
   324      HTTP/1.1 200 OK
   325      Content-Type: application/json
   326  
   327      {
   328  		"AppArmorProfile": "",
   329  		"Args": [
   330  			"-c",
   331  			"exit 9"
   332  		],
   333  		"Config": {
   334  			"AttachStderr": true,
   335  			"AttachStdin": false,
   336  			"AttachStdout": true,
   337  			"Cmd": [
   338  				"/bin/sh",
   339  				"-c",
   340  				"exit 9"
   341  			],
   342  			"Domainname": "",
   343  			"Entrypoint": null,
   344  			"Env": [
   345  				"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
   346  			],
   347  			"ExposedPorts": null,
   348  			"Hostname": "ba033ac44011",
   349  			"Image": "ubuntu",
   350  			"Labels": {
   351  				"com.example.vendor": "Acme",
   352  				"com.example.license": "GPL",
   353  				"com.example.version": "1.0"
   354  			},
   355  			"MacAddress": "",
   356  			"NetworkDisabled": false,
   357  			"OnBuild": null,
   358  			"OpenStdin": false,
   359  			"PortSpecs": null,
   360  			"StdinOnce": false,
   361  			"Tty": false,
   362  			"User": "",
   363  			"Volumes": null,
   364  			"WorkingDir": ""
   365  		},
   366  		"Created": "2015-01-06T15:47:31.485331387Z",
   367  		"Driver": "devicemapper",
   368  		"ExecDriver": "native-0.2",
   369  		"ExecIDs": null,
   370  		"HostConfig": {
   371  			"Binds": null,
   372  			"BlkioWeight": 0,
   373  			"CapAdd": null,
   374  			"CapDrop": null,
   375  			"ContainerIDFile": "",
   376  			"CpusetCpus": "",
   377  			"CpusetMems": "",
   378  			"CpuShares": 0,
   379  			"CpuPeriod": 100000,
   380  			"Devices": [],
   381  			"Dns": null,
   382  			"DnsSearch": null,
   383  			"ExtraHosts": null,
   384  			"IpcMode": "",
   385  			"Links": null,
   386  			"LxcConf": [],
   387  			"Memory": 0,
   388  			"MemorySwap": 0,
   389  			"OomKillDisable": false,
   390  			"NetworkMode": "bridge",
   391  			"PortBindings": {},
   392  			"Privileged": false,
   393  			"ReadonlyRootfs": false,
   394  			"PublishAllPorts": false,
   395  			"RestartPolicy": {
   396  				"MaximumRetryCount": 2,
   397  				"Name": "on-failure"
   398  			},
   399  			"LogConfig": {
   400  				"Config": null,
   401  				"Type": "json-file"
   402  			},
   403  			"SecurityOpt": null,
   404  			"VolumesFrom": null,
   405  			"Ulimits": [{}]
   406  		},
   407  		"HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
   408  		"HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
   409  		"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
   410  		"Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
   411  		"Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
   412  		"MountLabel": "",
   413  		"Name": "/boring_euclid",
   414  		"NetworkSettings": {
   415  			"Bridge": "",
   416  			"Gateway": "",
   417  			"IPAddress": "",
   418  			"IPPrefixLen": 0,
   419  			"MacAddress": "",
   420  			"PortMapping": null,
   421  			"Ports": null
   422  		},
   423  		"Path": "/bin/sh",
   424  		"ProcessLabel": "",
   425  		"ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
   426  		"RestartCount": 1,
   427  		"State": {
   428  			"Error": "",
   429  			"ExitCode": 9,
   430  			"FinishedAt": "2015-01-06T15:47:32.080254511Z",
   431  			"OOMKilled": false,
   432  			"Paused": false,
   433  			"Pid": 0,
   434  			"Restarting": false,
   435  			"Running": false,
   436  			"StartedAt": "2015-01-06T15:47:32.072697474Z"
   437  		},
   438  		"Volumes": {},
   439  		"VolumesRW": {}
   440  	}
   441  
   442  Status Codes:
   443  
   444  -   **200** – no error
   445  -   **404** – no such container
   446  -   **500** – server error
   447  
   448  ### List processes running inside a container
   449  
   450  `GET /containers/(id)/top`
   451  
   452  List processes running inside the container `id`. On Unix systems this
   453  is done by running the `ps` command. This endpoint is not
   454  supported on Windows.
   455  
   456  **Example request**:
   457  
   458      GET /containers/4fa6e0f0c678/top HTTP/1.1
   459  
   460  **Example response**:
   461  
   462      HTTP/1.1 200 OK
   463      Content-Type: application/json
   464  
   465      {
   466         "Titles" : [
   467           "UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
   468         ],
   469         "Processes" : [
   470           [
   471             "root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
   472           ],
   473           [
   474             "root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
   475           ]
   476         ]
   477      }
   478  
   479  **Example request**:
   480  
   481      GET /containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
   482  
   483  **Example response**:
   484  
   485      HTTP/1.1 200 OK
   486      Content-Type: application/json
   487  
   488      {
   489        "Titles" : [
   490          "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
   491        ]
   492        "Processes" : [
   493          [
   494            "root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
   495          ],
   496          [
   497            "root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
   498          ]
   499        ],
   500      }
   501  
   502  Query Parameters:
   503  
   504  -   **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
   505  
   506  Status Codes:
   507  
   508  -   **200** – no error
   509  -   **404** – no such container
   510  -   **500** – server error
   511  
   512  ### Get container logs
   513  
   514  `GET /containers/(id)/logs`
   515  
   516  Get `stdout` and `stderr` logs from the container ``id``
   517  
   518  > **Note**:
   519  > This endpoint works only for containers with the `json-file` or `journald` logging drivers.
   520  
   521  **Example request**:
   522  
   523       GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1&timestamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
   524  
   525  **Example response**:
   526  
   527       HTTP/1.1 101 UPGRADED
   528       Content-Type: application/vnd.docker.raw-stream
   529       Connection: Upgrade
   530       Upgrade: tcp
   531  
   532       {{ STREAM }}
   533  
   534  Query Parameters:
   535  
   536  -   **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
   537  -   **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
   538  -   **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
   539  -   **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
   540      will only output log-entries since that timestamp. Default: 0 (unfiltered)
   541  -   **timestamps** – 1/True/true or 0/False/false, print timestamps for
   542          every log line. Default `false`.
   543  -   **tail** – Output specified number of lines at the end of logs: `all` or `<number>`. Default all.
   544  
   545  Status Codes:
   546  
   547  -   **101** – no error, hints proxy about hijacking
   548  -   **200** – no error, no upgrade header found
   549  -   **404** – no such container
   550  -   **500** – server error
   551  
   552  ### Inspect changes on a container's filesystem
   553  
   554  `GET /containers/(id)/changes`
   555  
   556  Inspect changes on container `id`'s filesystem
   557  
   558  **Example request**:
   559  
   560      GET /containers/4fa6e0f0c678/changes HTTP/1.1
   561  
   562  **Example response**:
   563  
   564      HTTP/1.1 200 OK
   565      Content-Type: application/json
   566  
   567      [
   568           {
   569                   "Path": "/dev",
   570                   "Kind": 0
   571           },
   572           {
   573                   "Path": "/dev/kmsg",
   574                   "Kind": 1
   575           },
   576           {
   577                   "Path": "/test",
   578                   "Kind": 1
   579           }
   580      ]
   581  
   582  Values for `Kind`:
   583  
   584  - `0`: Modify
   585  - `1`: Add
   586  - `2`: Delete
   587  
   588  Status Codes:
   589  
   590  -   **200** – no error
   591  -   **404** – no such container
   592  -   **500** – server error
   593  
   594  ### Export a container
   595  
   596  `GET /containers/(id)/export`
   597  
   598  Export the contents of container `id`
   599  
   600  **Example request**:
   601  
   602      GET /containers/4fa6e0f0c678/export HTTP/1.1
   603  
   604  **Example response**:
   605  
   606      HTTP/1.1 200 OK
   607      Content-Type: application/octet-stream
   608  
   609      {{ TAR STREAM }}
   610  
   611  Status Codes:
   612  
   613  -   **200** – no error
   614  -   **404** – no such container
   615  -   **500** – server error
   616  
   617  ### Get container stats based on resource usage
   618  
   619  `GET /containers/(id)/stats`
   620  
   621  This endpoint returns a live stream of a container's resource usage statistics.
   622  
   623  **Example request**:
   624  
   625      GET /containers/redis1/stats HTTP/1.1
   626  
   627  **Example response**:
   628  
   629        HTTP/1.1 200 OK
   630        Content-Type: application/json
   631  
   632        {
   633           "read" : "2015-01-08T22:57:31.547920715Z",
   634           "network" : {
   635              "rx_dropped" : 0,
   636              "rx_bytes" : 648,
   637              "rx_errors" : 0,
   638              "tx_packets" : 8,
   639              "tx_dropped" : 0,
   640              "rx_packets" : 8,
   641              "tx_errors" : 0,
   642              "tx_bytes" : 648
   643           },
   644           "memory_stats" : {
   645              "stats" : {
   646                 "total_pgmajfault" : 0,
   647                 "cache" : 0,
   648                 "mapped_file" : 0,
   649                 "total_inactive_file" : 0,
   650                 "pgpgout" : 414,
   651                 "rss" : 6537216,
   652                 "total_mapped_file" : 0,
   653                 "writeback" : 0,
   654                 "unevictable" : 0,
   655                 "pgpgin" : 477,
   656                 "total_unevictable" : 0,
   657                 "pgmajfault" : 0,
   658                 "total_rss" : 6537216,
   659                 "total_rss_huge" : 6291456,
   660                 "total_writeback" : 0,
   661                 "total_inactive_anon" : 0,
   662                 "rss_huge" : 6291456,
   663                 "hierarchical_memory_limit" : 67108864,
   664                 "total_pgfault" : 964,
   665                 "total_active_file" : 0,
   666                 "active_anon" : 6537216,
   667                 "total_active_anon" : 6537216,
   668                 "total_pgpgout" : 414,
   669                 "total_cache" : 0,
   670                 "inactive_anon" : 0,
   671                 "active_file" : 0,
   672                 "pgfault" : 964,
   673                 "inactive_file" : 0,
   674                 "total_pgpgin" : 477
   675              },
   676              "max_usage" : 6651904,
   677              "usage" : 6537216,
   678              "failcnt" : 0,
   679              "limit" : 67108864
   680           },
   681           "blkio_stats" : {},
   682           "cpu_stats" : {
   683              "cpu_usage" : {
   684                 "percpu_usage" : [
   685                    16970827,
   686                    1839451,
   687                    7107380,
   688                    10571290
   689                 ],
   690                 "usage_in_usermode" : 10000000,
   691                 "total_usage" : 36488948,
   692                 "usage_in_kernelmode" : 20000000
   693              },
   694              "system_cpu_usage" : 20091722000000000,
   695              "throttling_data" : {}
   696           }
   697        }
   698  
   699  Query Parameters:
   700  
   701  -   **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
   702  
   703  Status Codes:
   704  
   705  -   **200** – no error
   706  -   **404** – no such container
   707  -   **500** – server error
   708  
   709  ### Resize a container TTY
   710  
   711  `POST /containers/(id)/resize?h=<height>&w=<width>`
   712  
   713  Resize the TTY for container with  `id`. You must restart the container for the resize to take effect.
   714  
   715  **Example request**:
   716  
   717        POST /containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
   718  
   719  **Example response**:
   720  
   721        HTTP/1.1 200 OK
   722        Content-Length: 0
   723        Content-Type: text/plain; charset=utf-8
   724  
   725  Status Codes:
   726  
   727  -   **200** – no error
   728  -   **404** – No such container
   729  -   **500** – Cannot resize container
   730  
   731  ### Start a container
   732  
   733  `POST /containers/(id)/start`
   734  
   735  Start the container `id`
   736  
   737  > **Note**:
   738  > For backwards compatibility, this endpoint accepts a `HostConfig` as JSON-encoded request body.
   739  > See [create a container](#create-a-container) for details.
   740  
   741  **Example request**:
   742  
   743       POST /containers/(id)/start HTTP/1.1
   744  
   745  **Example response**:
   746  
   747       HTTP/1.1 204 No Content
   748  
   749  Status Codes:
   750  
   751  -   **204** – no error
   752  -   **304** – container already started
   753  -   **404** – no such container
   754  -   **500** – server error
   755  
   756  ### Stop a container
   757  
   758  `POST /containers/(id)/stop`
   759  
   760  Stop the container `id`
   761  
   762  **Example request**:
   763  
   764      POST /containers/e90e34656806/stop?t=5 HTTP/1.1
   765  
   766  **Example response**:
   767  
   768      HTTP/1.1 204 No Content
   769  
   770  Query Parameters:
   771  
   772  -   **t** – number of seconds to wait before killing the container
   773  
   774  Status Codes:
   775  
   776  -   **204** – no error
   777  -   **304** – container already stopped
   778  -   **404** – no such container
   779  -   **500** – server error
   780  
   781  ### Restart a container
   782  
   783  `POST /containers/(id)/restart`
   784  
   785  Restart the container `id`
   786  
   787  **Example request**:
   788  
   789      POST /containers/e90e34656806/restart?t=5 HTTP/1.1
   790  
   791  **Example response**:
   792  
   793      HTTP/1.1 204 No Content
   794  
   795  Query Parameters:
   796  
   797  -   **t** – number of seconds to wait before killing the container
   798  
   799  Status Codes:
   800  
   801  -   **204** – no error
   802  -   **404** – no such container
   803  -   **500** – server error
   804  
   805  ### Kill a container
   806  
   807  `POST /containers/(id)/kill`
   808  
   809  Kill the container `id`
   810  
   811  **Example request**:
   812  
   813      POST /containers/e90e34656806/kill HTTP/1.1
   814  
   815  **Example response**:
   816  
   817      HTTP/1.1 204 No Content
   818  
   819  Query Parameters
   820  
   821  -   **signal** - Signal to send to the container: integer or string like `SIGINT`.
   822          When not set, `SIGKILL` is assumed and the call waits for the container to exit.
   823  
   824  Status Codes:
   825  
   826  -   **204** – no error
   827  -   **404** – no such container
   828  -   **500** – server error
   829  
   830  ### Rename a container
   831  
   832  `POST /containers/(id)/rename`
   833  
   834  Rename the container `id` to a `new_name`
   835  
   836  **Example request**:
   837  
   838      POST /containers/e90e34656806/rename?name=new_name HTTP/1.1
   839  
   840  **Example response**:
   841  
   842      HTTP/1.1 204 No Content
   843  
   844  Query Parameters:
   845  
   846  -   **name** – new name for the container
   847  
   848  Status Codes:
   849  
   850  -   **204** – no error
   851  -   **404** – no such container
   852  -   **409** - conflict name already assigned
   853  -   **500** – server error
   854  
   855  ### Pause a container
   856  
   857  `POST /containers/(id)/pause`
   858  
   859  Pause the container `id`
   860  
   861  **Example request**:
   862  
   863      POST /containers/e90e34656806/pause HTTP/1.1
   864  
   865  **Example response**:
   866  
   867      HTTP/1.1 204 No Content
   868  
   869  Status Codes:
   870  
   871  -   **204** – no error
   872  -   **404** – no such container
   873  -   **500** – server error
   874  
   875  ### Unpause a container
   876  
   877  `POST /containers/(id)/unpause`
   878  
   879  Unpause the container `id`
   880  
   881  **Example request**:
   882  
   883      POST /containers/e90e34656806/unpause HTTP/1.1
   884  
   885  **Example response**:
   886  
   887      HTTP/1.1 204 No Content
   888  
   889  Status Codes:
   890  
   891  -   **204** – no error
   892  -   **404** – no such container
   893  -   **500** – server error
   894  
   895  ### Attach to a container
   896  
   897  `POST /containers/(id)/attach`
   898  
   899  Attach to the container `id`
   900  
   901  **Example request**:
   902  
   903      POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
   904  
   905  **Example response**:
   906  
   907      HTTP/1.1 101 UPGRADED
   908      Content-Type: application/vnd.docker.raw-stream
   909      Connection: Upgrade
   910      Upgrade: tcp
   911  
   912      {{ STREAM }}
   913  
   914  Query Parameters:
   915  
   916  -   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
   917  -   **stream** – 1/True/true or 0/False/false, return stream.
   918          Default `false`.
   919  -   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
   920          to `stdin`. Default `false`.
   921  -   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
   922          `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
   923  -   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
   924          `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
   925  
   926  Status Codes:
   927  
   928  -   **101** – no error, hints proxy about hijacking
   929  -   **200** – no error, no upgrade header found
   930  -   **400** – bad parameter
   931  -   **404** – no such container
   932  -   **500** – server error
   933  
   934      **Stream details**:
   935  
   936      When using the TTY setting is enabled in
   937      [`POST /containers/create`
   938      ](#create-a-container),
   939      the stream is the raw data from the process PTY and client's `stdin`.
   940      When the TTY is disabled, then the stream is multiplexed to separate
   941      `stdout` and `stderr`.
   942  
   943      The format is a **Header** and a **Payload** (frame).
   944  
   945      **HEADER**
   946  
   947      The header contains the information which the stream writes (`stdout` or
   948      `stderr`). It also contains the size of the associated frame encoded in the
   949      last four bytes (`uint32`).
   950  
   951      It is encoded on the first eight bytes like this:
   952  
   953          header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
   954  
   955      `STREAM_TYPE` can be:
   956  
   957  -   0: `stdin` (is written on `stdout`)
   958  -   1: `stdout`
   959  -   2: `stderr`
   960  
   961      `SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
   962      the `uint32` size encoded as big endian.
   963  
   964      **PAYLOAD**
   965  
   966      The payload is the raw stream.
   967  
   968      **IMPLEMENTATION**
   969  
   970      The simplest way to implement the Attach protocol is the following:
   971  
   972      1.  Read eight bytes.
   973      2.  Choose `stdout` or `stderr` depending on the first byte.
   974      3.  Extract the frame size from the last four bytes.
   975      4.  Read the extracted size and output it on the correct output.
   976      5.  Goto 1.
   977  
   978  ### Attach to a container (websocket)
   979  
   980  `GET /containers/(id)/attach/ws`
   981  
   982  Attach to the container `id` via websocket
   983  
   984  Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
   985  
   986  **Example request**
   987  
   988      GET /containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
   989  
   990  **Example response**
   991  
   992      {{ STREAM }}
   993  
   994  Query Parameters:
   995  
   996  -   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
   997  -   **stream** – 1/True/true or 0/False/false, return stream.
   998          Default `false`.
   999  -   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
  1000          to `stdin`. Default `false`.
  1001  -   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
  1002          `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
  1003  -   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
  1004          `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
  1005  
  1006  Status Codes:
  1007  
  1008  -   **200** – no error
  1009  -   **400** – bad parameter
  1010  -   **404** – no such container
  1011  -   **500** – server error
  1012  
  1013  ### Wait a container
  1014  
  1015  `POST /containers/(id)/wait`
  1016  
  1017  Block until container `id` stops, then returns the exit code
  1018  
  1019  **Example request**:
  1020  
  1021      POST /containers/16253994b7c4/wait HTTP/1.1
  1022  
  1023  **Example response**:
  1024  
  1025      HTTP/1.1 200 OK
  1026      Content-Type: application/json
  1027  
  1028      {"StatusCode": 0}
  1029  
  1030  Status Codes:
  1031  
  1032  -   **200** – no error
  1033  -   **404** – no such container
  1034  -   **500** – server error
  1035  
  1036  ### Remove a container
  1037  
  1038  `DELETE /containers/(id)`
  1039  
  1040  Remove the container `id` from the filesystem
  1041  
  1042  **Example request**:
  1043  
  1044      DELETE /containers/16253994b7c4?v=1 HTTP/1.1
  1045  
  1046  **Example response**:
  1047  
  1048      HTTP/1.1 204 No Content
  1049  
  1050  Query Parameters:
  1051  
  1052  -   **v** – 1/True/true or 0/False/false, Remove the volumes
  1053          associated to the container. Default `false`.
  1054  -   **force** - 1/True/true or 0/False/false, Kill then remove the container.
  1055          Default `false`.
  1056  
  1057  Status Codes:
  1058  
  1059  -   **204** – no error
  1060  -   **400** – bad parameter
  1061  -   **404** – no such container
  1062  -   **500** – server error
  1063  
  1064  ### Copy files or folders from a container
  1065  
  1066  `POST /containers/(id)/copy`
  1067  
  1068  Copy files or folders of container `id`
  1069  
  1070  **Example request**:
  1071  
  1072      POST /containers/4fa6e0f0c678/copy HTTP/1.1
  1073      Content-Type: application/json
  1074  
  1075      {
  1076           "Resource": "test.txt"
  1077      }
  1078  
  1079  **Example response**:
  1080  
  1081      HTTP/1.1 200 OK
  1082      Content-Type: application/x-tar
  1083  
  1084      {{ TAR STREAM }}
  1085  
  1086  Status Codes:
  1087  
  1088  -   **200** – no error
  1089  -   **404** – no such container
  1090  -   **500** – server error
  1091  
  1092  ## 2.2 Images
  1093  
  1094  ### List Images
  1095  
  1096  `GET /images/json`
  1097  
  1098  **Example request**:
  1099  
  1100      GET /images/json?all=0 HTTP/1.1
  1101  
  1102  **Example response**:
  1103  
  1104      HTTP/1.1 200 OK
  1105      Content-Type: application/json
  1106  
  1107      [
  1108        {
  1109           "RepoTags": [
  1110             "ubuntu:12.04",
  1111             "ubuntu:precise",
  1112             "ubuntu:latest"
  1113           ],
  1114           "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
  1115           "Created": 1365714795,
  1116           "Size": 131506275,
  1117           "VirtualSize": 131506275,
  1118           "Labels": {}
  1119        },
  1120        {
  1121           "RepoTags": [
  1122             "ubuntu:12.10",
  1123             "ubuntu:quantal"
  1124           ],
  1125           "ParentId": "27cf784147099545",
  1126           "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  1127           "Created": 1364102658,
  1128           "Size": 24653,
  1129           "VirtualSize": 180116135,
  1130           "Labels": {
  1131              "com.example.version": "v1"
  1132           }
  1133        }
  1134      ]
  1135  
  1136  **Example request, with digest information**:
  1137  
  1138      GET /images/json?digests=1 HTTP/1.1
  1139  
  1140  **Example response, with digest information**:
  1141  
  1142      HTTP/1.1 200 OK
  1143      Content-Type: application/json
  1144  
  1145      [
  1146        {
  1147          "Created": 1420064636,
  1148          "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
  1149          "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
  1150          "RepoDigests": [
  1151            "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
  1152          ],
  1153          "RepoTags": [
  1154            "localhost:5000/test/busybox:latest",
  1155            "playdate:latest"
  1156          ],
  1157          "Size": 0,
  1158          "VirtualSize": 2429728,
  1159          "Labels": {}
  1160        }
  1161      ]
  1162  
  1163  The response shows a single image `Id` associated with two repositories
  1164  (`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
  1165  either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
  1166  `playdate:latest` to reference the image.
  1167  
  1168  You can also use `RepoDigests` values to reference an image. In this response,
  1169  the array has only one reference and that is to the
  1170  `localhost:5000/test/busybox` repository; the `playdate` repository has no
  1171  digest. You can reference this digest using the value:
  1172  `localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
  1173  
  1174  See the `docker run` and `docker build` commands for examples of digest and tag
  1175  references on the command line.
  1176  
  1177  Query Parameters:
  1178  
  1179  -   **all** – 1/True/true or 0/False/false, default false
  1180  -   **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
  1181    -   `dangling=true`
  1182    -   `label=key` or `label="key=value"` of an image label
  1183  -   **filter** - only return images with the specified name
  1184  
  1185  ### Build image from a Dockerfile
  1186  
  1187  `POST /build`
  1188  
  1189  Build an image from a Dockerfile
  1190  
  1191  **Example request**:
  1192  
  1193      POST /build HTTP/1.1
  1194  
  1195      {{ TAR STREAM }}
  1196  
  1197  **Example response**:
  1198  
  1199      HTTP/1.1 200 OK
  1200      Content-Type: application/json
  1201  
  1202      {"stream": "Step 1..."}
  1203      {"stream": "..."}
  1204      {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
  1205  
  1206  The input stream must be a `tar` archive compressed with one of the
  1207  following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
  1208  
  1209  The archive must include a build instructions file, typically called
  1210  `Dockerfile` at the archive's root. The `dockerfile` parameter may be
  1211  used to specify a different build instructions file. To do this, its value must be
  1212  the path to the alternate build instructions file to use.
  1213  
  1214  The archive may include any number of other files,
  1215  which are accessible in the build context (See the [*ADD build
  1216  command*](../../reference/builder.md#dockerbuilder)).
  1217  
  1218  The build is canceled if the client drops the connection by quitting
  1219  or being killed.
  1220  
  1221  Query Parameters:
  1222  
  1223  -   **dockerfile** - Path within the build context to the `Dockerfile`. This is
  1224          ignored if `remote` is specified and points to an external `Dockerfile`.
  1225  -   **t** – Repository name (and optionally a tag) to be applied to
  1226          the resulting image in case of success.
  1227  -   **remote** – A Git repository URI or HTTP/HTTPS context URI. If the
  1228          URI points to a single text file, the file's contents are placed into
  1229          a file called `Dockerfile` and the image is built from that file. If
  1230          the URI points to a tarball, the file is downloaded by the daemon and
  1231          the contents therein used as the context for the build. If the URI
  1232          points to a tarball and the `dockerfile` parameter is also specified,
  1233          there must be a file with the corresponding path inside the tarball.
  1234  -   **q** – Suppress verbose build output.
  1235  -   **nocache** – Do not use the cache when building the image.
  1236  -   **pull** - Attempt to pull the image even if an older image exists locally.
  1237  -   **rm** - Remove intermediate containers after a successful build (default behavior).
  1238  -   **forcerm** - Always remove intermediate containers (includes `rm`).
  1239  -   **memory** - Set memory limit for build.
  1240  -   **memswap** - Total memory (memory + swap), `-1` to disable swap.
  1241  -   **cpushares** - CPU shares (relative weight).
  1242  -   **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
  1243  -   **cpuperiod** - The length of a CPU period in microseconds.
  1244  -   **cpuquota** - Microseconds of CPU time that the container can get in a CPU period.
  1245  
  1246      Request Headers:
  1247  
  1248  -   **Content-type** – Set to `"application/tar"`.
  1249  -   **X-Registry-Config** – base64-encoded ConfigFile object
  1250  
  1251  Status Codes:
  1252  
  1253  -   **200** – no error
  1254  -   **500** – server error
  1255  
  1256  ### Create an image
  1257  
  1258  `POST /images/create`
  1259  
  1260  Create an image either by pulling it from the registry or by importing it
  1261  
  1262  **Example request**:
  1263  
  1264      POST /images/create?fromImage=ubuntu HTTP/1.1
  1265  
  1266  **Example response**:
  1267  
  1268      HTTP/1.1 200 OK
  1269      Content-Type: application/json
  1270  
  1271      {"status": "Pulling..."}
  1272      {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
  1273      {"error": "Invalid..."}
  1274      ...
  1275  
  1276  When using this endpoint to pull an image from the registry, the
  1277  `X-Registry-Auth` header can be used to include
  1278  a base64-encoded AuthConfig object.
  1279  
  1280  Query Parameters:
  1281  
  1282  -   **fromImage** – Name of the image to pull.
  1283  -   **fromSrc** – Source to import.  The value may be a URL from which the image
  1284          can be retrieved or `-` to read the image from the request body.
  1285  -   **repo** – Repository name.
  1286  -   **tag** – Tag.
  1287  -   **registry** – The registry to pull from.
  1288  
  1289      Request Headers:
  1290  
  1291  -   **X-Registry-Auth** – base64-encoded AuthConfig object
  1292  
  1293  Status Codes:
  1294  
  1295  -   **200** – no error
  1296  -   **500** – server error
  1297  
  1298  
  1299  
  1300  ### Inspect an image
  1301  
  1302  `GET /images/(name)/json`
  1303  
  1304  Return low-level information on the image `name`
  1305  
  1306  **Example request**:
  1307  
  1308      GET /images/ubuntu/json HTTP/1.1
  1309  
  1310  **Example response**:
  1311  
  1312      HTTP/1.1 200 OK
  1313      Content-Type: application/json
  1314  
  1315      {
  1316           "Created": "2013-03-23T22:24:18.818426-07:00",
  1317           "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
  1318           "ContainerConfig":
  1319                   {
  1320                           "Hostname": "",
  1321                           "User": "",
  1322                           "AttachStdin": false,
  1323                           "AttachStdout": false,
  1324                           "AttachStderr": false,
  1325                           "PortSpecs": null,
  1326                           "Tty": true,
  1327                           "OpenStdin": true,
  1328                           "StdinOnce": false,
  1329                           "Env": null,
  1330                           "Cmd": ["/bin/bash"],
  1331                           "Dns": null,
  1332                           "Image": "ubuntu",
  1333                           "Labels": {
  1334                               "com.example.vendor": "Acme",
  1335                               "com.example.license": "GPL",
  1336                               "com.example.version": "1.0"
  1337                           },
  1338                           "Volumes": null,
  1339                           "VolumesFrom": "",
  1340                           "WorkingDir": ""
  1341                   },
  1342           "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  1343           "Parent": "27cf784147099545",
  1344           "Size": 6824592
  1345      }
  1346  
  1347  Status Codes:
  1348  
  1349  -   **200** – no error
  1350  -   **404** – no such image
  1351  -   **500** – server error
  1352  
  1353  ### Get the history of an image
  1354  
  1355  `GET /images/(name)/history`
  1356  
  1357  Return the history of the image `name`
  1358  
  1359  **Example request**:
  1360  
  1361      GET /images/ubuntu/history HTTP/1.1
  1362  
  1363  **Example response**:
  1364  
  1365      HTTP/1.1 200 OK
  1366      Content-Type: application/json
  1367  
  1368      [    
  1369          {    
  1370              "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
  1371              "Created": 1398108230,
  1372              "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
  1373              "Tags": [
  1374                  "ubuntu:lucid",
  1375                  "ubuntu:10.04"
  1376              ],   
  1377              "Size": 182964289,
  1378              "Comment": ""
  1379          },   
  1380          {    
  1381              "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
  1382              "Created": 1398108222,
  1383              "CreatedBy": "/bin/sh -c #(nop) MAINTAINER Tianon Gravi <admwiggin@gmail.com> - mkimage-debootstrap.sh -i iproute,iputils-ping,ubuntu-minimal -t lucid.tar.xz lucid http://archive.ubuntu.com/ubuntu/",
  1384              "Tags": null,
  1385              "Size": 0,
  1386              "Comment": ""
  1387          },   
  1388          {    
  1389              "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
  1390              "Created": 1371157430,
  1391              "CreatedBy": "",
  1392              "Tags": [
  1393                  "scratch12:latest",
  1394                  "scratch:latest"
  1395              ],   
  1396              "Size": 0,
  1397              "Comment": "Imported from -"
  1398          }    
  1399      ]
  1400  
  1401  Status Codes:
  1402  
  1403  -   **200** – no error
  1404  -   **404** – no such image
  1405  -   **500** – server error
  1406  
  1407  ### Push an image on the registry
  1408  
  1409  `POST /images/(name)/push`
  1410  
  1411  Push the image `name` on the registry
  1412  
  1413  **Example request**:
  1414  
  1415      POST /images/test/push HTTP/1.1
  1416  
  1417  **Example response**:
  1418  
  1419      HTTP/1.1 200 OK
  1420      Content-Type: application/json
  1421  
  1422      {"status": "Pushing..."}
  1423      {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
  1424      {"error": "Invalid..."}
  1425      ...
  1426  
  1427  If you wish to push an image on to a private registry, that image must already have a tag
  1428  into a repository which references that registry `hostname` and `port`.  This repository name should
  1429  then be used in the URL. This duplicates the command line's flow.
  1430  
  1431  **Example request**:
  1432  
  1433      POST /images/registry.acme.com:5000/test/push HTTP/1.1
  1434  
  1435  
  1436  Query Parameters:
  1437  
  1438  -   **tag** – The tag to associate with the image on the registry. This is optional.
  1439  
  1440  Request Headers:
  1441  
  1442  -   **X-Registry-Auth** – Include a base64-encoded AuthConfig.
  1443          object.
  1444  
  1445  Status Codes:
  1446  
  1447  -   **200** – no error
  1448  -   **404** – no such image
  1449  -   **500** – server error
  1450  
  1451  ### Tag an image into a repository
  1452  
  1453  `POST /images/(name)/tag`
  1454  
  1455  Tag the image `name` into a repository
  1456  
  1457  **Example request**:
  1458  
  1459      POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
  1460  
  1461  **Example response**:
  1462  
  1463      HTTP/1.1 201 OK
  1464  
  1465  Query Parameters:
  1466  
  1467  -   **repo** – The repository to tag in
  1468  -   **force** – 1/True/true or 0/False/false, default false
  1469  -   **tag** - The new tag name
  1470  
  1471  Status Codes:
  1472  
  1473  -   **201** – no error
  1474  -   **400** – bad parameter
  1475  -   **404** – no such image
  1476  -   **409** – conflict
  1477  -   **500** – server error
  1478  
  1479  ### Remove an image
  1480  
  1481  `DELETE /images/(name)`
  1482  
  1483  Remove the image `name` from the filesystem
  1484  
  1485  **Example request**:
  1486  
  1487      DELETE /images/test HTTP/1.1
  1488  
  1489  **Example response**:
  1490  
  1491      HTTP/1.1 200 OK
  1492      Content-type: application/json
  1493  
  1494      [
  1495       {"Untagged": "3e2f21a89f"},
  1496       {"Deleted": "3e2f21a89f"},
  1497       {"Deleted": "53b4f83ac9"}
  1498      ]
  1499  
  1500  Query Parameters:
  1501  
  1502  -   **force** – 1/True/true or 0/False/false, default false
  1503  -   **noprune** – 1/True/true or 0/False/false, default false
  1504  
  1505  Status Codes:
  1506  
  1507  -   **200** – no error
  1508  -   **404** – no such image
  1509  -   **409** – conflict
  1510  -   **500** – server error
  1511  
  1512  ### Search images
  1513  
  1514  `GET /images/search`
  1515  
  1516  Search for an image on [Docker Hub](https://hub.docker.com). This API
  1517  returns both `is_trusted` and `is_automated` images. Currently, they
  1518  are considered identical. In the future, the `is_trusted` property will
  1519  be deprecated and replaced by the `is_automated` property.
  1520  
  1521  > **Note**:
  1522  > The response keys have changed from API v1.6 to reflect the JSON
  1523  > sent by the registry server to the docker daemon's request.
  1524  
  1525  **Example request**:
  1526  
  1527      GET /images/search?term=sshd HTTP/1.1
  1528  
  1529  **Example response**:
  1530  
  1531      HTTP/1.1 200 OK
  1532      Content-Type: application/json
  1533  
  1534          [
  1535                  {
  1536                      "star_count": 12,
  1537                      "is_official": false,
  1538                      "name": "wma55/u1210sshd",
  1539                      "is_trusted": false,
  1540                      "is_automated": false,
  1541                      "description": "",
  1542                  },
  1543                  {
  1544                      "star_count": 10,
  1545                      "is_official": false,
  1546                      "name": "jdswinbank/sshd",
  1547                      "is_trusted": false,
  1548                      "is_automated": false,
  1549                      "description": "",
  1550                  },
  1551                  {
  1552                      "star_count": 18,
  1553                      "is_official": false,
  1554                      "name": "vgauthier/sshd",
  1555                      "is_trusted": false,
  1556                      "is_automated": false,
  1557                      "description": "",
  1558                  }
  1559          ...
  1560          ]
  1561  
  1562  Query Parameters:
  1563  
  1564  -   **term** – term to search
  1565  
  1566  Status Codes:
  1567  
  1568  -   **200** – no error
  1569  -   **500** – server error
  1570  
  1571  ## 2.3 Misc
  1572  
  1573  ### Check auth configuration
  1574  
  1575  `POST /auth`
  1576  
  1577  Get the default username and email
  1578  
  1579  **Example request**:
  1580  
  1581      POST /auth HTTP/1.1
  1582      Content-Type: application/json
  1583  
  1584      {
  1585           "username":" hannibal",
  1586           "password: "xxxx",
  1587           "email": "hannibal@a-team.com",
  1588           "serveraddress": "https://index.docker.io/v1/"
  1589      }
  1590  
  1591  **Example response**:
  1592  
  1593      HTTP/1.1 200 OK
  1594  
  1595  Status Codes:
  1596  
  1597  -   **200** – no error
  1598  -   **204** – no error
  1599  -   **500** – server error
  1600  
  1601  ### Display system-wide information
  1602  
  1603  `GET /info`
  1604  
  1605  Display system-wide information
  1606  
  1607  **Example request**:
  1608  
  1609      GET /info HTTP/1.1
  1610  
  1611  **Example response**:
  1612  
  1613      HTTP/1.1 200 OK
  1614      Content-Type: application/json
  1615  
  1616      {
  1617          "Containers": 11,
  1618          "CpuCfsPeriod": true,
  1619          "CpuCfsQuota": true,
  1620          "Debug": false,
  1621          "DockerRootDir": "/var/lib/docker",
  1622          "Driver": "btrfs",
  1623          "DriverStatus": [[""]],
  1624          "ExecutionDriver": "native-0.1",
  1625          "ExperimentalBuild": false,
  1626          "HttpProxy": "http://test:test@localhost:8080",
  1627          "HttpsProxy": "https://test:test@localhost:8080",
  1628          "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
  1629          "IPv4Forwarding": true,
  1630          "Images": 16,
  1631          "IndexServerAddress": "https://index.docker.io/v1/",
  1632          "InitPath": "/usr/bin/docker",
  1633          "InitSha1": "",
  1634          "KernelVersion": "3.12.0-1-amd64",
  1635          "Labels": [
  1636              "storage=ssd"
  1637          ],
  1638          "MemTotal": 2099236864,
  1639          "MemoryLimit": true,
  1640          "NCPU": 1,
  1641          "NEventsListener": 0,
  1642          "NFd": 11,
  1643          "NGoroutines": 21,
  1644          "Name": "prod-server-42",
  1645          "NoProxy": "9.81.1.160",
  1646          "OomKillDisable": true,
  1647          "OperatingSystem": "Boot2Docker",
  1648          "RegistryConfig": {
  1649              "IndexConfigs": {
  1650                  "docker.io": {
  1651                      "Mirrors": null,
  1652                      "Name": "docker.io",
  1653                      "Official": true,
  1654                      "Secure": true
  1655                  }
  1656              },
  1657              "InsecureRegistryCIDRs": [
  1658                  "127.0.0.0/8"
  1659              ]
  1660          },
  1661          "SwapLimit": false,
  1662          "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
  1663      }
  1664  
  1665  Status Codes:
  1666  
  1667  -   **200** – no error
  1668  -   **500** – server error
  1669  
  1670  ### Show the docker version information
  1671  
  1672  `GET /version`
  1673  
  1674  Show the docker version information
  1675  
  1676  **Example request**:
  1677  
  1678      GET /version HTTP/1.1
  1679  
  1680  **Example response**:
  1681  
  1682      HTTP/1.1 200 OK
  1683      Content-Type: application/json
  1684  
  1685      {
  1686           "Version": "1.5.0",
  1687           "Os": "linux",
  1688           "KernelVersion": "3.18.5-tinycore64",
  1689           "GoVersion": "go1.4.1",
  1690           "GitCommit": "a8a31ef",
  1691           "Arch": "amd64",
  1692           "ApiVersion": "1.19"
  1693      }
  1694  
  1695  Status Codes:
  1696  
  1697  -   **200** – no error
  1698  -   **500** – server error
  1699  
  1700  ### Ping the docker server
  1701  
  1702  `GET /_ping`
  1703  
  1704  Ping the docker server
  1705  
  1706  **Example request**:
  1707  
  1708      GET /_ping HTTP/1.1
  1709  
  1710  **Example response**:
  1711  
  1712      HTTP/1.1 200 OK
  1713      Content-Type: text/plain
  1714  
  1715      OK
  1716  
  1717  Status Codes:
  1718  
  1719  -   **200** - no error
  1720  -   **500** - server error
  1721  
  1722  ### Create a new image from a container's changes
  1723  
  1724  `POST /commit`
  1725  
  1726  Create a new image from a container's changes
  1727  
  1728  **Example request**:
  1729  
  1730      POST /commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
  1731      Content-Type: application/json
  1732  
  1733      {
  1734           "Hostname": "",
  1735           "Domainname": "",
  1736           "User": "",
  1737           "AttachStdin": false,
  1738           "AttachStdout": true,
  1739           "AttachStderr": true,
  1740           "PortSpecs": null,
  1741           "Tty": false,
  1742           "OpenStdin": false,
  1743           "StdinOnce": false,
  1744           "Env": null,
  1745           "Cmd": [
  1746                   "date"
  1747           ],
  1748           "Volumes": {
  1749                   "/tmp": {}
  1750           },
  1751           "Labels": {
  1752                   "key1": "value1",
  1753                   "key2": "value2"
  1754            },
  1755           "WorkingDir": "",
  1756           "NetworkDisabled": false,
  1757           "ExposedPorts": {
  1758                   "22/tcp": {}
  1759           }
  1760      }
  1761  
  1762  **Example response**:
  1763  
  1764      HTTP/1.1 201 Created
  1765      Content-Type: application/json
  1766  
  1767      {"Id": "596069db4bf5"}
  1768  
  1769  Json Parameters:
  1770  
  1771  -  **config** - the container's configuration
  1772  
  1773  Query Parameters:
  1774  
  1775  -   **container** – source container
  1776  -   **repo** – repository
  1777  -   **tag** – tag
  1778  -   **comment** – commit message
  1779  -   **author** – author (e.g., "John Hannibal Smith
  1780      <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
  1781  
  1782  Status Codes:
  1783  
  1784  -   **201** – no error
  1785  -   **404** – no such container
  1786  -   **500** – server error
  1787  
  1788  ### Monitor Docker's events
  1789  
  1790  `GET /events`
  1791  
  1792  Get container events from docker, either in real time via streaming, or via
  1793  polling (using since).
  1794  
  1795  Docker containers report the following events:
  1796  
  1797      attach, commit, copy, create, destroy, die, exec_create, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause
  1798  
  1799  and Docker images report:
  1800  
  1801      untag, delete
  1802  
  1803  **Example request**:
  1804  
  1805      GET /events?since=1374067924
  1806  
  1807  **Example response**:
  1808  
  1809      HTTP/1.1 200 OK
  1810      Content-Type: application/json
  1811  
  1812      {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
  1813      {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
  1814      {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966}
  1815      {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970}
  1816  
  1817  Query Parameters:
  1818  
  1819  -   **since** – Timestamp used for polling
  1820  -   **until** – Timestamp used for polling
  1821  -   **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
  1822    -   `event=<string>`; -- event to filter
  1823    -   `image=<string>`; -- image to filter
  1824    -   `container=<string>`; -- container to filter
  1825  
  1826  Status Codes:
  1827  
  1828  -   **200** – no error
  1829  -   **500** – server error
  1830  
  1831  ### Get a tarball containing all images in a repository
  1832  
  1833  `GET /images/(name)/get`
  1834  
  1835  Get a tarball containing all images and metadata for the repository specified
  1836  by `name`.
  1837  
  1838  If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
  1839  (and its parents) are returned. If `name` is an image ID, similarly only that
  1840  image (and its parents) are returned, but with the exclusion of the
  1841  'repositories' file in the tarball, as there were no image names referenced.
  1842  
  1843  See the [image tarball format](#image-tarball-format) for more details.
  1844  
  1845  **Example request**
  1846  
  1847      GET /images/ubuntu/get
  1848  
  1849  **Example response**:
  1850  
  1851      HTTP/1.1 200 OK
  1852      Content-Type: application/x-tar
  1853  
  1854      Binary data stream
  1855  
  1856  Status Codes:
  1857  
  1858  -   **200** – no error
  1859  -   **500** – server error
  1860  
  1861  ### Get a tarball containing all images.
  1862  
  1863  `GET /images/get`
  1864  
  1865  Get a tarball containing all images and metadata for one or more repositories.
  1866  
  1867  For each value of the `names` parameter: if it is a specific name and tag (e.g.
  1868  `ubuntu:latest`), then only that image (and its parents) are returned; if it is
  1869  an image ID, similarly only that image (and its parents) are returned and there
  1870  would be no names referenced in the 'repositories' file for this image ID.
  1871  
  1872  See the [image tarball format](#image-tarball-format) for more details.
  1873  
  1874  **Example request**
  1875  
  1876      GET /images/get?names=myname%2Fmyapp%3Alatest&names=busybox
  1877  
  1878  **Example response**:
  1879  
  1880      HTTP/1.1 200 OK
  1881      Content-Type: application/x-tar
  1882  
  1883      Binary data stream
  1884  
  1885  Status Codes:
  1886  
  1887  -   **200** – no error
  1888  -   **500** – server error
  1889  
  1890  ### Load a tarball with a set of images and tags into docker
  1891  
  1892  `POST /images/load`
  1893  
  1894  Load a set of images and tags into a Docker repository.
  1895  See the [image tarball format](#image-tarball-format) for more details.
  1896  
  1897  **Example request**
  1898  
  1899      POST /images/load
  1900  
  1901      Tarball in body
  1902  
  1903  **Example response**:
  1904  
  1905      HTTP/1.1 200 OK
  1906  
  1907  Status Codes:
  1908  
  1909  -   **200** – no error
  1910  -   **500** – server error
  1911  
  1912  ### Image tarball format
  1913  
  1914  An image tarball contains one directory per image layer (named using its long ID),
  1915  each containing these files:
  1916  
  1917  - `VERSION`: currently `1.0` - the file format version
  1918  - `json`: detailed layer information, similar to `docker inspect layer_id`
  1919  - `layer.tar`: A tarfile containing the filesystem changes in this layer
  1920  
  1921  The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
  1922  for storing attribute changes and deletions.
  1923  
  1924  If the tarball defines a repository, the tarball should also include a `repositories` file at
  1925  the root that contains a list of repository and tag names mapped to layer IDs.
  1926  
  1927  ```
  1928  {"hello-world":
  1929      {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
  1930  }
  1931  ```
  1932  
  1933  ### Exec Create
  1934  
  1935  `POST /containers/(id)/exec`
  1936  
  1937  Sets up an exec instance in a running container `id`
  1938  
  1939  **Example request**:
  1940  
  1941      POST /containers/e90e34656806/exec HTTP/1.1
  1942      Content-Type: application/json
  1943  
  1944        {
  1945         "AttachStdin": false,
  1946         "AttachStdout": true,
  1947         "AttachStderr": true,
  1948         "Tty": false,
  1949         "Cmd": [
  1950                       "date"
  1951               ],
  1952        }
  1953  
  1954  **Example response**:
  1955  
  1956      HTTP/1.1 201 OK
  1957      Content-Type: application/json
  1958  
  1959      {
  1960           "Id": "f90e34656806",
  1961           "Warnings":[]
  1962      }
  1963  
  1964  Json Parameters:
  1965  
  1966  -   **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
  1967  -   **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
  1968  -   **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
  1969  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  1970  -   **Cmd** - Command to run specified as a string or an array of strings.
  1971  
  1972  
  1973  Status Codes:
  1974  
  1975  -   **201** – no error
  1976  -   **404** – no such container
  1977  
  1978  ### Exec Start
  1979  
  1980  `POST /exec/(id)/start`
  1981  
  1982  Starts a previously set up `exec` instance `id`. If `detach` is true, this API
  1983  returns after starting the `exec` command. Otherwise, this API sets up an
  1984  interactive session with the `exec` command.
  1985  
  1986  **Example request**:
  1987  
  1988      POST /exec/e90e34656806/start HTTP/1.1
  1989      Content-Type: application/json
  1990  
  1991      {
  1992       "Detach": false,
  1993       "Tty": false,
  1994      }
  1995  
  1996  **Example response**:
  1997  
  1998      HTTP/1.1 201 OK
  1999      Content-Type: application/json
  2000  
  2001      {{ STREAM }}
  2002  
  2003  Json Parameters:
  2004  
  2005  -   **Detach** - Detach from the `exec` command.
  2006  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  2007  
  2008  Status Codes:
  2009  
  2010  -   **200** – no error
  2011  -   **404** – no such exec instance
  2012  
  2013      **Stream details**:
  2014      Similar to the stream behavior of `POST /container/(id)/attach` API
  2015  
  2016  ### Exec Resize
  2017  
  2018  `POST /exec/(id)/resize`
  2019  
  2020  Resizes the `tty` session used by the `exec` command `id`.
  2021  This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
  2022  
  2023  **Example request**:
  2024  
  2025      POST /exec/e90e34656806/resize HTTP/1.1
  2026      Content-Type: text/plain
  2027  
  2028  **Example response**:
  2029  
  2030      HTTP/1.1 201 OK
  2031      Content-Type: text/plain
  2032  
  2033  Query Parameters:
  2034  
  2035  -   **h** – height of `tty` session
  2036  -   **w** – width
  2037  
  2038  Status Codes:
  2039  
  2040  -   **201** – no error
  2041  -   **404** – no such exec instance
  2042  
  2043  ### Exec Inspect
  2044  
  2045  `GET /exec/(id)/json`
  2046  
  2047  Return low-level information about the `exec` command `id`.
  2048  
  2049  **Example request**:
  2050  
  2051      GET /exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
  2052  
  2053  **Example response**:
  2054  
  2055      HTTP/1.1 200 OK
  2056      Content-Type: plain/text
  2057  
  2058      {
  2059        "ID" : "11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39",
  2060        "Running" : false,
  2061        "ExitCode" : 2,
  2062        "ProcessConfig" : {
  2063          "privileged" : false,
  2064          "user" : "",
  2065          "tty" : false,
  2066          "entrypoint" : "sh",
  2067          "arguments" : [
  2068            "-c",
  2069            "exit 2"
  2070          ]
  2071        },
  2072        "OpenStdin" : false,
  2073        "OpenStderr" : false,
  2074        "OpenStdout" : false,
  2075        "Container" : {
  2076          "State" : {
  2077            "Running" : true,
  2078            "Paused" : false,
  2079            "Restarting" : false,
  2080            "OOMKilled" : false,
  2081            "Pid" : 3650,
  2082            "ExitCode" : 0,
  2083            "Error" : "",
  2084            "StartedAt" : "2014-11-17T22:26:03.717657531Z",
  2085            "FinishedAt" : "0001-01-01T00:00:00Z"
  2086          },
  2087          "ID" : "8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c",
  2088          "Created" : "2014-11-17T22:26:03.626304998Z",
  2089          "Path" : "date",
  2090          "Args" : [],
  2091          "Config" : {
  2092            "Hostname" : "8f177a186b97",
  2093            "Domainname" : "",
  2094            "User" : "",
  2095            "AttachStdin" : false,
  2096            "AttachStdout" : false,
  2097            "AttachStderr" : false,
  2098            "PortSpecs": null,
  2099            "ExposedPorts" : null,
  2100            "Tty" : false,
  2101            "OpenStdin" : false,
  2102            "StdinOnce" : false,
  2103            "Env" : [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ],
  2104            "Cmd" : [
  2105              "date"
  2106            ],
  2107            "Image" : "ubuntu",
  2108            "Volumes" : null,
  2109            "WorkingDir" : "",
  2110            "Entrypoint" : null,
  2111            "NetworkDisabled" : false,
  2112            "MacAddress" : "",
  2113            "OnBuild" : null,
  2114            "SecurityOpt" : null
  2115          },
  2116          "Image" : "5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5",
  2117          "NetworkSettings" : {
  2118            "IPAddress" : "172.17.0.2",
  2119            "IPPrefixLen" : 16,
  2120            "MacAddress" : "02:42:ac:11:00:02",
  2121            "Gateway" : "172.17.42.1",
  2122            "Bridge" : "docker0",
  2123            "PortMapping" : null,
  2124            "Ports" : {}
  2125          },
  2126          "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf",
  2127          "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname",
  2128          "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts",
  2129          "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
  2130          "Name" : "/test",
  2131          "Driver" : "aufs",
  2132          "ExecDriver" : "native-0.2",
  2133          "MountLabel" : "",
  2134          "ProcessLabel" : "",
  2135          "AppArmorProfile" : "",
  2136          "RestartCount" : 0,
  2137          "Volumes" : {},
  2138          "VolumesRW" : {}
  2139        }
  2140      }
  2141  
  2142  Status Codes:
  2143  
  2144  -   **200** – no error
  2145  -   **404** – no such exec instance
  2146  -   **500** - server error
  2147  
  2148  # 3. Going further
  2149  
  2150  ## 3.1 Inside `docker run`
  2151  
  2152  As an example, the `docker run` command line makes the following API calls:
  2153  
  2154  - Create the container
  2155  
  2156  - If the status code is 404, it means the image doesn't exist:
  2157      - Try to pull it.
  2158      - Then, retry to create the container.
  2159  
  2160  - Start the container.
  2161  
  2162  - If you are not in detached mode:
  2163  - Attach to the container, using `logs=1` (to have `stdout` and
  2164        `stderr` from the container's start) and `stream=1`
  2165  
  2166  - If in detached mode or only `stdin` is attached, display the container's id.
  2167  
  2168  ## 3.2 Hijacking
  2169  
  2170  In this version of the API, `/attach`, uses hijacking to transport `stdin`,
  2171  `stdout`, and `stderr` on the same socket.
  2172  
  2173  To hint potential proxies about connection hijacking, Docker client sends
  2174  connection upgrade headers similarly to websocket.
  2175  
  2176      Upgrade: tcp
  2177      Connection: Upgrade
  2178  
  2179  When Docker daemon detects the `Upgrade` header, it switches its status code
  2180  from **200 OK** to **101 UPGRADED** and resends the same headers.
  2181  
  2182  
  2183  ## 3.3 CORS Requests
  2184  
  2185  To set cross origin requests to the remote api please give values to 
  2186  `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
  2187  default or blank means CORS disabled
  2188  
  2189      $ docker -d -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"