github.com/walkingsparrow/docker@v1.4.2-0.20151218153551-b708a2249bfa/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  > **Note**: this functionality currently only works when using the *libcontainer* exec-driver.
   624  
   625  **Example request**:
   626  
   627      GET /containers/redis1/stats HTTP/1.1
   628  
   629  **Example response**:
   630  
   631        HTTP/1.1 200 OK
   632        Content-Type: application/json
   633  
   634        {
   635           "read" : "2015-01-08T22:57:31.547920715Z",
   636           "network" : {
   637              "rx_dropped" : 0,
   638              "rx_bytes" : 648,
   639              "rx_errors" : 0,
   640              "tx_packets" : 8,
   641              "tx_dropped" : 0,
   642              "rx_packets" : 8,
   643              "tx_errors" : 0,
   644              "tx_bytes" : 648
   645           },
   646           "memory_stats" : {
   647              "stats" : {
   648                 "total_pgmajfault" : 0,
   649                 "cache" : 0,
   650                 "mapped_file" : 0,
   651                 "total_inactive_file" : 0,
   652                 "pgpgout" : 414,
   653                 "rss" : 6537216,
   654                 "total_mapped_file" : 0,
   655                 "writeback" : 0,
   656                 "unevictable" : 0,
   657                 "pgpgin" : 477,
   658                 "total_unevictable" : 0,
   659                 "pgmajfault" : 0,
   660                 "total_rss" : 6537216,
   661                 "total_rss_huge" : 6291456,
   662                 "total_writeback" : 0,
   663                 "total_inactive_anon" : 0,
   664                 "rss_huge" : 6291456,
   665                 "hierarchical_memory_limit" : 67108864,
   666                 "total_pgfault" : 964,
   667                 "total_active_file" : 0,
   668                 "active_anon" : 6537216,
   669                 "total_active_anon" : 6537216,
   670                 "total_pgpgout" : 414,
   671                 "total_cache" : 0,
   672                 "inactive_anon" : 0,
   673                 "active_file" : 0,
   674                 "pgfault" : 964,
   675                 "inactive_file" : 0,
   676                 "total_pgpgin" : 477
   677              },
   678              "max_usage" : 6651904,
   679              "usage" : 6537216,
   680              "failcnt" : 0,
   681              "limit" : 67108864
   682           },
   683           "blkio_stats" : {},
   684           "cpu_stats" : {
   685              "cpu_usage" : {
   686                 "percpu_usage" : [
   687                    16970827,
   688                    1839451,
   689                    7107380,
   690                    10571290
   691                 ],
   692                 "usage_in_usermode" : 10000000,
   693                 "total_usage" : 36488948,
   694                 "usage_in_kernelmode" : 20000000
   695              },
   696              "system_cpu_usage" : 20091722000000000,
   697              "throttling_data" : {}
   698           }
   699        }
   700  
   701  Query Parameters:
   702  
   703  -   **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
   704  
   705  Status Codes:
   706  
   707  -   **200** – no error
   708  -   **404** – no such container
   709  -   **500** – server error
   710  
   711  ### Resize a container TTY
   712  
   713  `POST /containers/(id)/resize?h=<height>&w=<width>`
   714  
   715  Resize the TTY for container with  `id`. You must restart the container for the resize to take effect.
   716  
   717  **Example request**:
   718  
   719        POST /containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
   720  
   721  **Example response**:
   722  
   723        HTTP/1.1 200 OK
   724        Content-Length: 0
   725        Content-Type: text/plain; charset=utf-8
   726  
   727  Status Codes:
   728  
   729  -   **200** – no error
   730  -   **404** – No such container
   731  -   **500** – Cannot resize container
   732  
   733  ### Start a container
   734  
   735  `POST /containers/(id)/start`
   736  
   737  Start the container `id`
   738  
   739  > **Note**:
   740  > For backwards compatibility, this endpoint accepts a `HostConfig` as JSON-encoded request body.
   741  > See [create a container](#create-a-container) for details.
   742  
   743  **Example request**:
   744  
   745       POST /containers/(id)/start HTTP/1.1
   746  
   747  **Example response**:
   748  
   749       HTTP/1.1 204 No Content
   750  
   751  Status Codes:
   752  
   753  -   **204** – no error
   754  -   **304** – container already started
   755  -   **404** – no such container
   756  -   **500** – server error
   757  
   758  ### Stop a container
   759  
   760  `POST /containers/(id)/stop`
   761  
   762  Stop the container `id`
   763  
   764  **Example request**:
   765  
   766      POST /containers/e90e34656806/stop?t=5 HTTP/1.1
   767  
   768  **Example response**:
   769  
   770      HTTP/1.1 204 No Content
   771  
   772  Query Parameters:
   773  
   774  -   **t** – number of seconds to wait before killing the container
   775  
   776  Status Codes:
   777  
   778  -   **204** – no error
   779  -   **304** – container already stopped
   780  -   **404** – no such container
   781  -   **500** – server error
   782  
   783  ### Restart a container
   784  
   785  `POST /containers/(id)/restart`
   786  
   787  Restart the container `id`
   788  
   789  **Example request**:
   790  
   791      POST /containers/e90e34656806/restart?t=5 HTTP/1.1
   792  
   793  **Example response**:
   794  
   795      HTTP/1.1 204 No Content
   796  
   797  Query Parameters:
   798  
   799  -   **t** – number of seconds to wait before killing the container
   800  
   801  Status Codes:
   802  
   803  -   **204** – no error
   804  -   **404** – no such container
   805  -   **500** – server error
   806  
   807  ### Kill a container
   808  
   809  `POST /containers/(id)/kill`
   810  
   811  Kill the container `id`
   812  
   813  **Example request**:
   814  
   815      POST /containers/e90e34656806/kill HTTP/1.1
   816  
   817  **Example response**:
   818  
   819      HTTP/1.1 204 No Content
   820  
   821  Query Parameters
   822  
   823  -   **signal** - Signal to send to the container: integer or string like `SIGINT`.
   824          When not set, `SIGKILL` is assumed and the call waits for the container to exit.
   825  
   826  Status Codes:
   827  
   828  -   **204** – no error
   829  -   **404** – no such container
   830  -   **500** – server error
   831  
   832  ### Rename a container
   833  
   834  `POST /containers/(id)/rename`
   835  
   836  Rename the container `id` to a `new_name`
   837  
   838  **Example request**:
   839  
   840      POST /containers/e90e34656806/rename?name=new_name HTTP/1.1
   841  
   842  **Example response**:
   843  
   844      HTTP/1.1 204 No Content
   845  
   846  Query Parameters:
   847  
   848  -   **name** – new name for the container
   849  
   850  Status Codes:
   851  
   852  -   **204** – no error
   853  -   **404** – no such container
   854  -   **409** - conflict name already assigned
   855  -   **500** – server error
   856  
   857  ### Pause a container
   858  
   859  `POST /containers/(id)/pause`
   860  
   861  Pause the container `id`
   862  
   863  **Example request**:
   864  
   865      POST /containers/e90e34656806/pause HTTP/1.1
   866  
   867  **Example response**:
   868  
   869      HTTP/1.1 204 No Content
   870  
   871  Status Codes:
   872  
   873  -   **204** – no error
   874  -   **404** – no such container
   875  -   **500** – server error
   876  
   877  ### Unpause a container
   878  
   879  `POST /containers/(id)/unpause`
   880  
   881  Unpause the container `id`
   882  
   883  **Example request**:
   884  
   885      POST /containers/e90e34656806/unpause HTTP/1.1
   886  
   887  **Example response**:
   888  
   889      HTTP/1.1 204 No Content
   890  
   891  Status Codes:
   892  
   893  -   **204** – no error
   894  -   **404** – no such container
   895  -   **500** – server error
   896  
   897  ### Attach to a container
   898  
   899  `POST /containers/(id)/attach`
   900  
   901  Attach to the container `id`
   902  
   903  **Example request**:
   904  
   905      POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
   906  
   907  **Example response**:
   908  
   909      HTTP/1.1 101 UPGRADED
   910      Content-Type: application/vnd.docker.raw-stream
   911      Connection: Upgrade
   912      Upgrade: tcp
   913  
   914      {{ STREAM }}
   915  
   916  Query Parameters:
   917  
   918  -   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
   919  -   **stream** – 1/True/true or 0/False/false, return stream.
   920          Default `false`.
   921  -   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
   922          to `stdin`. Default `false`.
   923  -   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
   924          `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
   925  -   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
   926          `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
   927  
   928  Status Codes:
   929  
   930  -   **101** – no error, hints proxy about hijacking
   931  -   **200** – no error, no upgrade header found
   932  -   **400** – bad parameter
   933  -   **404** – no such container
   934  -   **500** – server error
   935  
   936      **Stream details**:
   937  
   938      When using the TTY setting is enabled in
   939      [`POST /containers/create`
   940      ](#create-a-container),
   941      the stream is the raw data from the process PTY and client's `stdin`.
   942      When the TTY is disabled, then the stream is multiplexed to separate
   943      `stdout` and `stderr`.
   944  
   945      The format is a **Header** and a **Payload** (frame).
   946  
   947      **HEADER**
   948  
   949      The header contains the information which the stream writes (`stdout` or
   950      `stderr`). It also contains the size of the associated frame encoded in the
   951      last four bytes (`uint32`).
   952  
   953      It is encoded on the first eight bytes like this:
   954  
   955          header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
   956  
   957      `STREAM_TYPE` can be:
   958  
   959  -   0: `stdin` (is written on `stdout`)
   960  -   1: `stdout`
   961  -   2: `stderr`
   962  
   963      `SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
   964      the `uint32` size encoded as big endian.
   965  
   966      **PAYLOAD**
   967  
   968      The payload is the raw stream.
   969  
   970      **IMPLEMENTATION**
   971  
   972      The simplest way to implement the Attach protocol is the following:
   973  
   974      1.  Read eight bytes.
   975      2.  Choose `stdout` or `stderr` depending on the first byte.
   976      3.  Extract the frame size from the last four bytes.
   977      4.  Read the extracted size and output it on the correct output.
   978      5.  Goto 1.
   979  
   980  ### Attach to a container (websocket)
   981  
   982  `GET /containers/(id)/attach/ws`
   983  
   984  Attach to the container `id` via websocket
   985  
   986  Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
   987  
   988  **Example request**
   989  
   990      GET /containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
   991  
   992  **Example response**
   993  
   994      {{ STREAM }}
   995  
   996  Query Parameters:
   997  
   998  -   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
   999  -   **stream** – 1/True/true or 0/False/false, return stream.
  1000          Default `false`.
  1001  -   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
  1002          to `stdin`. Default `false`.
  1003  -   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
  1004          `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
  1005  -   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
  1006          `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
  1007  
  1008  Status Codes:
  1009  
  1010  -   **200** – no error
  1011  -   **400** – bad parameter
  1012  -   **404** – no such container
  1013  -   **500** – server error
  1014  
  1015  ### Wait a container
  1016  
  1017  `POST /containers/(id)/wait`
  1018  
  1019  Block until container `id` stops, then returns the exit code
  1020  
  1021  **Example request**:
  1022  
  1023      POST /containers/16253994b7c4/wait HTTP/1.1
  1024  
  1025  **Example response**:
  1026  
  1027      HTTP/1.1 200 OK
  1028      Content-Type: application/json
  1029  
  1030      {"StatusCode": 0}
  1031  
  1032  Status Codes:
  1033  
  1034  -   **200** – no error
  1035  -   **404** – no such container
  1036  -   **500** – server error
  1037  
  1038  ### Remove a container
  1039  
  1040  `DELETE /containers/(id)`
  1041  
  1042  Remove the container `id` from the filesystem
  1043  
  1044  **Example request**:
  1045  
  1046      DELETE /containers/16253994b7c4?v=1 HTTP/1.1
  1047  
  1048  **Example response**:
  1049  
  1050      HTTP/1.1 204 No Content
  1051  
  1052  Query Parameters:
  1053  
  1054  -   **v** – 1/True/true or 0/False/false, Remove the volumes
  1055          associated to the container. Default `false`.
  1056  -   **force** - 1/True/true or 0/False/false, Kill then remove the container.
  1057          Default `false`.
  1058  
  1059  Status Codes:
  1060  
  1061  -   **204** – no error
  1062  -   **400** – bad parameter
  1063  -   **404** – no such container
  1064  -   **500** – server error
  1065  
  1066  ### Copy files or folders from a container
  1067  
  1068  `POST /containers/(id)/copy`
  1069  
  1070  Copy files or folders of container `id`
  1071  
  1072  **Example request**:
  1073  
  1074      POST /containers/4fa6e0f0c678/copy HTTP/1.1
  1075      Content-Type: application/json
  1076  
  1077      {
  1078           "Resource": "test.txt"
  1079      }
  1080  
  1081  **Example response**:
  1082  
  1083      HTTP/1.1 200 OK
  1084      Content-Type: application/x-tar
  1085  
  1086      {{ TAR STREAM }}
  1087  
  1088  Status Codes:
  1089  
  1090  -   **200** – no error
  1091  -   **404** – no such container
  1092  -   **500** – server error
  1093  
  1094  ## 2.2 Images
  1095  
  1096  ### List Images
  1097  
  1098  `GET /images/json`
  1099  
  1100  **Example request**:
  1101  
  1102      GET /images/json?all=0 HTTP/1.1
  1103  
  1104  **Example response**:
  1105  
  1106      HTTP/1.1 200 OK
  1107      Content-Type: application/json
  1108  
  1109      [
  1110        {
  1111           "RepoTags": [
  1112             "ubuntu:12.04",
  1113             "ubuntu:precise",
  1114             "ubuntu:latest"
  1115           ],
  1116           "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
  1117           "Created": 1365714795,
  1118           "Size": 131506275,
  1119           "VirtualSize": 131506275,
  1120           "Labels": {}
  1121        },
  1122        {
  1123           "RepoTags": [
  1124             "ubuntu:12.10",
  1125             "ubuntu:quantal"
  1126           ],
  1127           "ParentId": "27cf784147099545",
  1128           "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  1129           "Created": 1364102658,
  1130           "Size": 24653,
  1131           "VirtualSize": 180116135,
  1132           "Labels": {
  1133              "com.example.version": "v1"
  1134           }
  1135        }
  1136      ]
  1137  
  1138  **Example request, with digest information**:
  1139  
  1140      GET /images/json?digests=1 HTTP/1.1
  1141  
  1142  **Example response, with digest information**:
  1143  
  1144      HTTP/1.1 200 OK
  1145      Content-Type: application/json
  1146  
  1147      [
  1148        {
  1149          "Created": 1420064636,
  1150          "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
  1151          "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
  1152          "RepoDigests": [
  1153            "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
  1154          ],
  1155          "RepoTags": [
  1156            "localhost:5000/test/busybox:latest",
  1157            "playdate:latest"
  1158          ],
  1159          "Size": 0,
  1160          "VirtualSize": 2429728,
  1161          "Labels": {}
  1162        }
  1163      ]
  1164  
  1165  The response shows a single image `Id` associated with two repositories
  1166  (`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
  1167  either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
  1168  `playdate:latest` to reference the image.
  1169  
  1170  You can also use `RepoDigests` values to reference an image. In this response,
  1171  the array has only one reference and that is to the
  1172  `localhost:5000/test/busybox` repository; the `playdate` repository has no
  1173  digest. You can reference this digest using the value:
  1174  `localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
  1175  
  1176  See the `docker run` and `docker build` commands for examples of digest and tag
  1177  references on the command line.
  1178  
  1179  Query Parameters:
  1180  
  1181  -   **all** – 1/True/true or 0/False/false, default false
  1182  -   **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
  1183    -   `dangling=true`
  1184    -   `label=key` or `label="key=value"` of an image label
  1185  -   **filter** - only return images with the specified name
  1186  
  1187  ### Build image from a Dockerfile
  1188  
  1189  `POST /build`
  1190  
  1191  Build an image from a Dockerfile
  1192  
  1193  **Example request**:
  1194  
  1195      POST /build HTTP/1.1
  1196  
  1197      {{ TAR STREAM }}
  1198  
  1199  **Example response**:
  1200  
  1201      HTTP/1.1 200 OK
  1202      Content-Type: application/json
  1203  
  1204      {"stream": "Step 1..."}
  1205      {"stream": "..."}
  1206      {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
  1207  
  1208  The input stream must be a `tar` archive compressed with one of the
  1209  following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
  1210  
  1211  The archive must include a build instructions file, typically called
  1212  `Dockerfile` at the archive's root. The `dockerfile` parameter may be
  1213  used to specify a different build instructions file. To do this, its value must be
  1214  the path to the alternate build instructions file to use.
  1215  
  1216  The archive may include any number of other files,
  1217  which are accessible in the build context (See the [*ADD build
  1218  command*](../../reference/builder.md#dockerbuilder)).
  1219  
  1220  The build is canceled if the client drops the connection by quitting
  1221  or being killed.
  1222  
  1223  Query Parameters:
  1224  
  1225  -   **dockerfile** - Path within the build context to the `Dockerfile`. This is
  1226          ignored if `remote` is specified and points to an external `Dockerfile`.
  1227  -   **t** – Repository name (and optionally a tag) to be applied to
  1228          the resulting image in case of success.
  1229  -   **remote** – A Git repository URI or HTTP/HTTPS context URI. If the
  1230          URI points to a single text file, the file's contents are placed into
  1231          a file called `Dockerfile` and the image is built from that file. If
  1232          the URI points to a tarball, the file is downloaded by the daemon and
  1233          the contents therein used as the context for the build. If the URI
  1234          points to a tarball and the `dockerfile` parameter is also specified,
  1235          there must be a file with the corresponding path inside the tarball.
  1236  -   **q** – Suppress verbose build output.
  1237  -   **nocache** – Do not use the cache when building the image.
  1238  -   **pull** - Attempt to pull the image even if an older image exists locally.
  1239  -   **rm** - Remove intermediate containers after a successful build (default behavior).
  1240  -   **forcerm** - Always remove intermediate containers (includes `rm`).
  1241  -   **memory** - Set memory limit for build.
  1242  -   **memswap** - Total memory (memory + swap), `-1` to disable swap.
  1243  -   **cpushares** - CPU shares (relative weight).
  1244  -   **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
  1245  -   **cpuperiod** - The length of a CPU period in microseconds.
  1246  -   **cpuquota** - Microseconds of CPU time that the container can get in a CPU period.
  1247  
  1248      Request Headers:
  1249  
  1250  -   **Content-type** – Set to `"application/tar"`.
  1251  -   **X-Registry-Config** – base64-encoded ConfigFile object
  1252  
  1253  Status Codes:
  1254  
  1255  -   **200** – no error
  1256  -   **500** – server error
  1257  
  1258  ### Create an image
  1259  
  1260  `POST /images/create`
  1261  
  1262  Create an image either by pulling it from the registry or by importing it
  1263  
  1264  **Example request**:
  1265  
  1266      POST /images/create?fromImage=ubuntu HTTP/1.1
  1267  
  1268  **Example response**:
  1269  
  1270      HTTP/1.1 200 OK
  1271      Content-Type: application/json
  1272  
  1273      {"status": "Pulling..."}
  1274      {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
  1275      {"error": "Invalid..."}
  1276      ...
  1277  
  1278  When using this endpoint to pull an image from the registry, the
  1279  `X-Registry-Auth` header can be used to include
  1280  a base64-encoded AuthConfig object.
  1281  
  1282  Query Parameters:
  1283  
  1284  -   **fromImage** – Name of the image to pull.
  1285  -   **fromSrc** – Source to import.  The value may be a URL from which the image
  1286          can be retrieved or `-` to read the image from the request body.
  1287  -   **repo** – Repository name.
  1288  -   **tag** – Tag.
  1289  -   **registry** – The registry to pull from.
  1290  
  1291      Request Headers:
  1292  
  1293  -   **X-Registry-Auth** – base64-encoded AuthConfig object
  1294  
  1295  Status Codes:
  1296  
  1297  -   **200** – no error
  1298  -   **500** – server error
  1299  
  1300  
  1301  
  1302  ### Inspect an image
  1303  
  1304  `GET /images/(name)/json`
  1305  
  1306  Return low-level information on the image `name`
  1307  
  1308  **Example request**:
  1309  
  1310      GET /images/ubuntu/json HTTP/1.1
  1311  
  1312  **Example response**:
  1313  
  1314      HTTP/1.1 200 OK
  1315      Content-Type: application/json
  1316  
  1317      {
  1318           "Created": "2013-03-23T22:24:18.818426-07:00",
  1319           "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
  1320           "ContainerConfig":
  1321                   {
  1322                           "Hostname": "",
  1323                           "User": "",
  1324                           "AttachStdin": false,
  1325                           "AttachStdout": false,
  1326                           "AttachStderr": false,
  1327                           "PortSpecs": null,
  1328                           "Tty": true,
  1329                           "OpenStdin": true,
  1330                           "StdinOnce": false,
  1331                           "Env": null,
  1332                           "Cmd": ["/bin/bash"],
  1333                           "Dns": null,
  1334                           "Image": "ubuntu",
  1335                           "Labels": {
  1336                               "com.example.vendor": "Acme",
  1337                               "com.example.license": "GPL",
  1338                               "com.example.version": "1.0"
  1339                           },
  1340                           "Volumes": null,
  1341                           "VolumesFrom": "",
  1342                           "WorkingDir": ""
  1343                   },
  1344           "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  1345           "Parent": "27cf784147099545",
  1346           "Size": 6824592
  1347      }
  1348  
  1349  Status Codes:
  1350  
  1351  -   **200** – no error
  1352  -   **404** – no such image
  1353  -   **500** – server error
  1354  
  1355  ### Get the history of an image
  1356  
  1357  `GET /images/(name)/history`
  1358  
  1359  Return the history of the image `name`
  1360  
  1361  **Example request**:
  1362  
  1363      GET /images/ubuntu/history HTTP/1.1
  1364  
  1365  **Example response**:
  1366  
  1367      HTTP/1.1 200 OK
  1368      Content-Type: application/json
  1369  
  1370      [    
  1371          {    
  1372              "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
  1373              "Created": 1398108230,
  1374              "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
  1375              "Tags": [
  1376                  "ubuntu:lucid",
  1377                  "ubuntu:10.04"
  1378              ],   
  1379              "Size": 182964289,
  1380              "Comment": ""
  1381          },   
  1382          {    
  1383              "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
  1384              "Created": 1398108222,
  1385              "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/",
  1386              "Tags": null,
  1387              "Size": 0,
  1388              "Comment": ""
  1389          },   
  1390          {    
  1391              "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
  1392              "Created": 1371157430,
  1393              "CreatedBy": "",
  1394              "Tags": [
  1395                  "scratch12:latest",
  1396                  "scratch:latest"
  1397              ],   
  1398              "Size": 0,
  1399              "Comment": "Imported from -"
  1400          }    
  1401      ]
  1402  
  1403  Status Codes:
  1404  
  1405  -   **200** – no error
  1406  -   **404** – no such image
  1407  -   **500** – server error
  1408  
  1409  ### Push an image on the registry
  1410  
  1411  `POST /images/(name)/push`
  1412  
  1413  Push the image `name` on the registry
  1414  
  1415  **Example request**:
  1416  
  1417      POST /images/test/push HTTP/1.1
  1418  
  1419  **Example response**:
  1420  
  1421      HTTP/1.1 200 OK
  1422      Content-Type: application/json
  1423  
  1424      {"status": "Pushing..."}
  1425      {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
  1426      {"error": "Invalid..."}
  1427      ...
  1428  
  1429  If you wish to push an image on to a private registry, that image must already have a tag
  1430  into a repository which references that registry `hostname` and `port`.  This repository name should
  1431  then be used in the URL. This duplicates the command line's flow.
  1432  
  1433  **Example request**:
  1434  
  1435      POST /images/registry.acme.com:5000/test/push HTTP/1.1
  1436  
  1437  
  1438  Query Parameters:
  1439  
  1440  -   **tag** – The tag to associate with the image on the registry. This is optional.
  1441  
  1442  Request Headers:
  1443  
  1444  -   **X-Registry-Auth** – Include a base64-encoded AuthConfig.
  1445          object.
  1446  
  1447  Status Codes:
  1448  
  1449  -   **200** – no error
  1450  -   **404** – no such image
  1451  -   **500** – server error
  1452  
  1453  ### Tag an image into a repository
  1454  
  1455  `POST /images/(name)/tag`
  1456  
  1457  Tag the image `name` into a repository
  1458  
  1459  **Example request**:
  1460  
  1461      POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
  1462  
  1463  **Example response**:
  1464  
  1465      HTTP/1.1 201 OK
  1466  
  1467  Query Parameters:
  1468  
  1469  -   **repo** – The repository to tag in
  1470  -   **force** – 1/True/true or 0/False/false, default false
  1471  -   **tag** - The new tag name
  1472  
  1473  Status Codes:
  1474  
  1475  -   **201** – no error
  1476  -   **400** – bad parameter
  1477  -   **404** – no such image
  1478  -   **409** – conflict
  1479  -   **500** – server error
  1480  
  1481  ### Remove an image
  1482  
  1483  `DELETE /images/(name)`
  1484  
  1485  Remove the image `name` from the filesystem
  1486  
  1487  **Example request**:
  1488  
  1489      DELETE /images/test HTTP/1.1
  1490  
  1491  **Example response**:
  1492  
  1493      HTTP/1.1 200 OK
  1494      Content-type: application/json
  1495  
  1496      [
  1497       {"Untagged": "3e2f21a89f"},
  1498       {"Deleted": "3e2f21a89f"},
  1499       {"Deleted": "53b4f83ac9"}
  1500      ]
  1501  
  1502  Query Parameters:
  1503  
  1504  -   **force** – 1/True/true or 0/False/false, default false
  1505  -   **noprune** – 1/True/true or 0/False/false, default false
  1506  
  1507  Status Codes:
  1508  
  1509  -   **200** – no error
  1510  -   **404** – no such image
  1511  -   **409** – conflict
  1512  -   **500** – server error
  1513  
  1514  ### Search images
  1515  
  1516  `GET /images/search`
  1517  
  1518  Search for an image on [Docker Hub](https://hub.docker.com). This API
  1519  returns both `is_trusted` and `is_automated` images. Currently, they
  1520  are considered identical. In the future, the `is_trusted` property will
  1521  be deprecated and replaced by the `is_automated` property.
  1522  
  1523  > **Note**:
  1524  > The response keys have changed from API v1.6 to reflect the JSON
  1525  > sent by the registry server to the docker daemon's request.
  1526  
  1527  **Example request**:
  1528  
  1529      GET /images/search?term=sshd HTTP/1.1
  1530  
  1531  **Example response**:
  1532  
  1533      HTTP/1.1 200 OK
  1534      Content-Type: application/json
  1535  
  1536          [
  1537                  {
  1538                      "star_count": 12,
  1539                      "is_official": false,
  1540                      "name": "wma55/u1210sshd",
  1541                      "is_trusted": false,
  1542                      "is_automated": false,
  1543                      "description": "",
  1544                  },
  1545                  {
  1546                      "star_count": 10,
  1547                      "is_official": false,
  1548                      "name": "jdswinbank/sshd",
  1549                      "is_trusted": false,
  1550                      "is_automated": false,
  1551                      "description": "",
  1552                  },
  1553                  {
  1554                      "star_count": 18,
  1555                      "is_official": false,
  1556                      "name": "vgauthier/sshd",
  1557                      "is_trusted": false,
  1558                      "is_automated": false,
  1559                      "description": "",
  1560                  }
  1561          ...
  1562          ]
  1563  
  1564  Query Parameters:
  1565  
  1566  -   **term** – term to search
  1567  
  1568  Status Codes:
  1569  
  1570  -   **200** – no error
  1571  -   **500** – server error
  1572  
  1573  ## 2.3 Misc
  1574  
  1575  ### Check auth configuration
  1576  
  1577  `POST /auth`
  1578  
  1579  Get the default username and email
  1580  
  1581  **Example request**:
  1582  
  1583      POST /auth HTTP/1.1
  1584      Content-Type: application/json
  1585  
  1586      {
  1587           "username":" hannibal",
  1588           "password: "xxxx",
  1589           "email": "hannibal@a-team.com",
  1590           "serveraddress": "https://index.docker.io/v1/"
  1591      }
  1592  
  1593  **Example response**:
  1594  
  1595      HTTP/1.1 200 OK
  1596  
  1597  Status Codes:
  1598  
  1599  -   **200** – no error
  1600  -   **204** – no error
  1601  -   **500** – server error
  1602  
  1603  ### Display system-wide information
  1604  
  1605  `GET /info`
  1606  
  1607  Display system-wide information
  1608  
  1609  **Example request**:
  1610  
  1611      GET /info HTTP/1.1
  1612  
  1613  **Example response**:
  1614  
  1615      HTTP/1.1 200 OK
  1616      Content-Type: application/json
  1617  
  1618      {
  1619          "Containers": 11,
  1620          "CpuCfsPeriod": true,
  1621          "CpuCfsQuota": true,
  1622          "Debug": false,
  1623          "DockerRootDir": "/var/lib/docker",
  1624          "Driver": "btrfs",
  1625          "DriverStatus": [[""]],
  1626          "ExecutionDriver": "native-0.1",
  1627          "ExperimentalBuild": false,
  1628          "HttpProxy": "http://test:test@localhost:8080",
  1629          "HttpsProxy": "https://test:test@localhost:8080",
  1630          "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
  1631          "IPv4Forwarding": true,
  1632          "Images": 16,
  1633          "IndexServerAddress": "https://index.docker.io/v1/",
  1634          "InitPath": "/usr/bin/docker",
  1635          "InitSha1": "",
  1636          "KernelVersion": "3.12.0-1-amd64",
  1637          "Labels": [
  1638              "storage=ssd"
  1639          ],
  1640          "MemTotal": 2099236864,
  1641          "MemoryLimit": true,
  1642          "NCPU": 1,
  1643          "NEventsListener": 0,
  1644          "NFd": 11,
  1645          "NGoroutines": 21,
  1646          "Name": "prod-server-42",
  1647          "NoProxy": "9.81.1.160",
  1648          "OomKillDisable": true,
  1649          "OperatingSystem": "Boot2Docker",
  1650          "RegistryConfig": {
  1651              "IndexConfigs": {
  1652                  "docker.io": {
  1653                      "Mirrors": null,
  1654                      "Name": "docker.io",
  1655                      "Official": true,
  1656                      "Secure": true
  1657                  }
  1658              },
  1659              "InsecureRegistryCIDRs": [
  1660                  "127.0.0.0/8"
  1661              ]
  1662          },
  1663          "SwapLimit": false,
  1664          "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
  1665      }
  1666  
  1667  Status Codes:
  1668  
  1669  -   **200** – no error
  1670  -   **500** – server error
  1671  
  1672  ### Show the docker version information
  1673  
  1674  `GET /version`
  1675  
  1676  Show the docker version information
  1677  
  1678  **Example request**:
  1679  
  1680      GET /version HTTP/1.1
  1681  
  1682  **Example response**:
  1683  
  1684      HTTP/1.1 200 OK
  1685      Content-Type: application/json
  1686  
  1687      {
  1688           "Version": "1.5.0",
  1689           "Os": "linux",
  1690           "KernelVersion": "3.18.5-tinycore64",
  1691           "GoVersion": "go1.4.1",
  1692           "GitCommit": "a8a31ef",
  1693           "Arch": "amd64",
  1694           "ApiVersion": "1.19"
  1695      }
  1696  
  1697  Status Codes:
  1698  
  1699  -   **200** – no error
  1700  -   **500** – server error
  1701  
  1702  ### Ping the docker server
  1703  
  1704  `GET /_ping`
  1705  
  1706  Ping the docker server
  1707  
  1708  **Example request**:
  1709  
  1710      GET /_ping HTTP/1.1
  1711  
  1712  **Example response**:
  1713  
  1714      HTTP/1.1 200 OK
  1715      Content-Type: text/plain
  1716  
  1717      OK
  1718  
  1719  Status Codes:
  1720  
  1721  -   **200** - no error
  1722  -   **500** - server error
  1723  
  1724  ### Create a new image from a container's changes
  1725  
  1726  `POST /commit`
  1727  
  1728  Create a new image from a container's changes
  1729  
  1730  **Example request**:
  1731  
  1732      POST /commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
  1733      Content-Type: application/json
  1734  
  1735      {
  1736           "Hostname": "",
  1737           "Domainname": "",
  1738           "User": "",
  1739           "AttachStdin": false,
  1740           "AttachStdout": true,
  1741           "AttachStderr": true,
  1742           "PortSpecs": null,
  1743           "Tty": false,
  1744           "OpenStdin": false,
  1745           "StdinOnce": false,
  1746           "Env": null,
  1747           "Cmd": [
  1748                   "date"
  1749           ],
  1750           "Volumes": {
  1751                   "/tmp": {}
  1752           },
  1753           "Labels": {
  1754                   "key1": "value1",
  1755                   "key2": "value2"
  1756            },
  1757           "WorkingDir": "",
  1758           "NetworkDisabled": false,
  1759           "ExposedPorts": {
  1760                   "22/tcp": {}
  1761           }
  1762      }
  1763  
  1764  **Example response**:
  1765  
  1766      HTTP/1.1 201 Created
  1767      Content-Type: application/json
  1768  
  1769      {"Id": "596069db4bf5"}
  1770  
  1771  Json Parameters:
  1772  
  1773  -  **config** - the container's configuration
  1774  
  1775  Query Parameters:
  1776  
  1777  -   **container** – source container
  1778  -   **repo** – repository
  1779  -   **tag** – tag
  1780  -   **comment** – commit message
  1781  -   **author** – author (e.g., "John Hannibal Smith
  1782      <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
  1783  
  1784  Status Codes:
  1785  
  1786  -   **201** – no error
  1787  -   **404** – no such container
  1788  -   **500** – server error
  1789  
  1790  ### Monitor Docker's events
  1791  
  1792  `GET /events`
  1793  
  1794  Get container events from docker, either in real time via streaming, or via
  1795  polling (using since).
  1796  
  1797  Docker containers report the following events:
  1798  
  1799      attach, commit, copy, create, destroy, die, exec_create, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause
  1800  
  1801  and Docker images report:
  1802  
  1803      untag, delete
  1804  
  1805  **Example request**:
  1806  
  1807      GET /events?since=1374067924
  1808  
  1809  **Example response**:
  1810  
  1811      HTTP/1.1 200 OK
  1812      Content-Type: application/json
  1813  
  1814      {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
  1815      {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
  1816      {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966}
  1817      {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970}
  1818  
  1819  Query Parameters:
  1820  
  1821  -   **since** – Timestamp used for polling
  1822  -   **until** – Timestamp used for polling
  1823  -   **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
  1824    -   `event=<string>`; -- event to filter
  1825    -   `image=<string>`; -- image to filter
  1826    -   `container=<string>`; -- container to filter
  1827  
  1828  Status Codes:
  1829  
  1830  -   **200** – no error
  1831  -   **500** – server error
  1832  
  1833  ### Get a tarball containing all images in a repository
  1834  
  1835  `GET /images/(name)/get`
  1836  
  1837  Get a tarball containing all images and metadata for the repository specified
  1838  by `name`.
  1839  
  1840  If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
  1841  (and its parents) are returned. If `name` is an image ID, similarly only that
  1842  image (and its parents) are returned, but with the exclusion of the
  1843  'repositories' file in the tarball, as there were no image names referenced.
  1844  
  1845  See the [image tarball format](#image-tarball-format) for more details.
  1846  
  1847  **Example request**
  1848  
  1849      GET /images/ubuntu/get
  1850  
  1851  **Example response**:
  1852  
  1853      HTTP/1.1 200 OK
  1854      Content-Type: application/x-tar
  1855  
  1856      Binary data stream
  1857  
  1858  Status Codes:
  1859  
  1860  -   **200** – no error
  1861  -   **500** – server error
  1862  
  1863  ### Get a tarball containing all images.
  1864  
  1865  `GET /images/get`
  1866  
  1867  Get a tarball containing all images and metadata for one or more repositories.
  1868  
  1869  For each value of the `names` parameter: if it is a specific name and tag (e.g.
  1870  `ubuntu:latest`), then only that image (and its parents) are returned; if it is
  1871  an image ID, similarly only that image (and its parents) are returned and there
  1872  would be no names referenced in the 'repositories' file for this image ID.
  1873  
  1874  See the [image tarball format](#image-tarball-format) for more details.
  1875  
  1876  **Example request**
  1877  
  1878      GET /images/get?names=myname%2Fmyapp%3Alatest&names=busybox
  1879  
  1880  **Example response**:
  1881  
  1882      HTTP/1.1 200 OK
  1883      Content-Type: application/x-tar
  1884  
  1885      Binary data stream
  1886  
  1887  Status Codes:
  1888  
  1889  -   **200** – no error
  1890  -   **500** – server error
  1891  
  1892  ### Load a tarball with a set of images and tags into docker
  1893  
  1894  `POST /images/load`
  1895  
  1896  Load a set of images and tags into a Docker repository.
  1897  See the [image tarball format](#image-tarball-format) for more details.
  1898  
  1899  **Example request**
  1900  
  1901      POST /images/load
  1902  
  1903      Tarball in body
  1904  
  1905  **Example response**:
  1906  
  1907      HTTP/1.1 200 OK
  1908  
  1909  Status Codes:
  1910  
  1911  -   **200** – no error
  1912  -   **500** – server error
  1913  
  1914  ### Image tarball format
  1915  
  1916  An image tarball contains one directory per image layer (named using its long ID),
  1917  each containing these files:
  1918  
  1919  - `VERSION`: currently `1.0` - the file format version
  1920  - `json`: detailed layer information, similar to `docker inspect layer_id`
  1921  - `layer.tar`: A tarfile containing the filesystem changes in this layer
  1922  
  1923  The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
  1924  for storing attribute changes and deletions.
  1925  
  1926  If the tarball defines a repository, the tarball should also include a `repositories` file at
  1927  the root that contains a list of repository and tag names mapped to layer IDs.
  1928  
  1929  ```
  1930  {"hello-world":
  1931      {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
  1932  }
  1933  ```
  1934  
  1935  ### Exec Create
  1936  
  1937  `POST /containers/(id)/exec`
  1938  
  1939  Sets up an exec instance in a running container `id`
  1940  
  1941  **Example request**:
  1942  
  1943      POST /containers/e90e34656806/exec HTTP/1.1
  1944      Content-Type: application/json
  1945  
  1946        {
  1947         "AttachStdin": false,
  1948         "AttachStdout": true,
  1949         "AttachStderr": true,
  1950         "Tty": false,
  1951         "Cmd": [
  1952                       "date"
  1953               ],
  1954        }
  1955  
  1956  **Example response**:
  1957  
  1958      HTTP/1.1 201 OK
  1959      Content-Type: application/json
  1960  
  1961      {
  1962           "Id": "f90e34656806",
  1963           "Warnings":[]
  1964      }
  1965  
  1966  Json Parameters:
  1967  
  1968  -   **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
  1969  -   **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
  1970  -   **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
  1971  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  1972  -   **Cmd** - Command to run specified as a string or an array of strings.
  1973  
  1974  
  1975  Status Codes:
  1976  
  1977  -   **201** – no error
  1978  -   **404** – no such container
  1979  
  1980  ### Exec Start
  1981  
  1982  `POST /exec/(id)/start`
  1983  
  1984  Starts a previously set up `exec` instance `id`. If `detach` is true, this API
  1985  returns after starting the `exec` command. Otherwise, this API sets up an
  1986  interactive session with the `exec` command.
  1987  
  1988  **Example request**:
  1989  
  1990      POST /exec/e90e34656806/start HTTP/1.1
  1991      Content-Type: application/json
  1992  
  1993      {
  1994       "Detach": false,
  1995       "Tty": false,
  1996      }
  1997  
  1998  **Example response**:
  1999  
  2000      HTTP/1.1 201 OK
  2001      Content-Type: application/json
  2002  
  2003      {{ STREAM }}
  2004  
  2005  Json Parameters:
  2006  
  2007  -   **Detach** - Detach from the `exec` command.
  2008  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  2009  
  2010  Status Codes:
  2011  
  2012  -   **200** – no error
  2013  -   **404** – no such exec instance
  2014  
  2015      **Stream details**:
  2016      Similar to the stream behavior of `POST /container/(id)/attach` API
  2017  
  2018  ### Exec Resize
  2019  
  2020  `POST /exec/(id)/resize`
  2021  
  2022  Resizes the `tty` session used by the `exec` command `id`.
  2023  This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
  2024  
  2025  **Example request**:
  2026  
  2027      POST /exec/e90e34656806/resize HTTP/1.1
  2028      Content-Type: text/plain
  2029  
  2030  **Example response**:
  2031  
  2032      HTTP/1.1 201 OK
  2033      Content-Type: text/plain
  2034  
  2035  Query Parameters:
  2036  
  2037  -   **h** – height of `tty` session
  2038  -   **w** – width
  2039  
  2040  Status Codes:
  2041  
  2042  -   **201** – no error
  2043  -   **404** – no such exec instance
  2044  
  2045  ### Exec Inspect
  2046  
  2047  `GET /exec/(id)/json`
  2048  
  2049  Return low-level information about the `exec` command `id`.
  2050  
  2051  **Example request**:
  2052  
  2053      GET /exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
  2054  
  2055  **Example response**:
  2056  
  2057      HTTP/1.1 200 OK
  2058      Content-Type: plain/text
  2059  
  2060      {
  2061        "ID" : "11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39",
  2062        "Running" : false,
  2063        "ExitCode" : 2,
  2064        "ProcessConfig" : {
  2065          "privileged" : false,
  2066          "user" : "",
  2067          "tty" : false,
  2068          "entrypoint" : "sh",
  2069          "arguments" : [
  2070            "-c",
  2071            "exit 2"
  2072          ]
  2073        },
  2074        "OpenStdin" : false,
  2075        "OpenStderr" : false,
  2076        "OpenStdout" : false,
  2077        "Container" : {
  2078          "State" : {
  2079            "Running" : true,
  2080            "Paused" : false,
  2081            "Restarting" : false,
  2082            "OOMKilled" : false,
  2083            "Pid" : 3650,
  2084            "ExitCode" : 0,
  2085            "Error" : "",
  2086            "StartedAt" : "2014-11-17T22:26:03.717657531Z",
  2087            "FinishedAt" : "0001-01-01T00:00:00Z"
  2088          },
  2089          "ID" : "8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c",
  2090          "Created" : "2014-11-17T22:26:03.626304998Z",
  2091          "Path" : "date",
  2092          "Args" : [],
  2093          "Config" : {
  2094            "Hostname" : "8f177a186b97",
  2095            "Domainname" : "",
  2096            "User" : "",
  2097            "AttachStdin" : false,
  2098            "AttachStdout" : false,
  2099            "AttachStderr" : false,
  2100            "PortSpecs": null,
  2101            "ExposedPorts" : null,
  2102            "Tty" : false,
  2103            "OpenStdin" : false,
  2104            "StdinOnce" : false,
  2105            "Env" : [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ],
  2106            "Cmd" : [
  2107              "date"
  2108            ],
  2109            "Image" : "ubuntu",
  2110            "Volumes" : null,
  2111            "WorkingDir" : "",
  2112            "Entrypoint" : null,
  2113            "NetworkDisabled" : false,
  2114            "MacAddress" : "",
  2115            "OnBuild" : null,
  2116            "SecurityOpt" : null
  2117          },
  2118          "Image" : "5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5",
  2119          "NetworkSettings" : {
  2120            "IPAddress" : "172.17.0.2",
  2121            "IPPrefixLen" : 16,
  2122            "MacAddress" : "02:42:ac:11:00:02",
  2123            "Gateway" : "172.17.42.1",
  2124            "Bridge" : "docker0",
  2125            "PortMapping" : null,
  2126            "Ports" : {}
  2127          },
  2128          "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf",
  2129          "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname",
  2130          "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts",
  2131          "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
  2132          "Name" : "/test",
  2133          "Driver" : "aufs",
  2134          "ExecDriver" : "native-0.2",
  2135          "MountLabel" : "",
  2136          "ProcessLabel" : "",
  2137          "AppArmorProfile" : "",
  2138          "RestartCount" : 0,
  2139          "Volumes" : {},
  2140          "VolumesRW" : {}
  2141        }
  2142      }
  2143  
  2144  Status Codes:
  2145  
  2146  -   **200** – no error
  2147  -   **404** – no such exec instance
  2148  -   **500** - server error
  2149  
  2150  # 3. Going further
  2151  
  2152  ## 3.1 Inside `docker run`
  2153  
  2154  As an example, the `docker run` command line makes the following API calls:
  2155  
  2156  - Create the container
  2157  
  2158  - If the status code is 404, it means the image doesn't exist:
  2159      - Try to pull it.
  2160      - Then, retry to create the container.
  2161  
  2162  - Start the container.
  2163  
  2164  - If you are not in detached mode:
  2165  - Attach to the container, using `logs=1` (to have `stdout` and
  2166        `stderr` from the container's start) and `stream=1`
  2167  
  2168  - If in detached mode or only `stdin` is attached, display the container's id.
  2169  
  2170  ## 3.2 Hijacking
  2171  
  2172  In this version of the API, `/attach`, uses hijacking to transport `stdin`,
  2173  `stdout`, and `stderr` on the same socket.
  2174  
  2175  To hint potential proxies about connection hijacking, Docker client sends
  2176  connection upgrade headers similarly to websocket.
  2177  
  2178      Upgrade: tcp
  2179      Connection: Upgrade
  2180  
  2181  When Docker daemon detects the `Upgrade` header, it switches its status code
  2182  from **200 OK** to **101 UPGRADED** and resends the same headers.
  2183  
  2184  
  2185  ## 3.3 CORS Requests
  2186  
  2187  To set cross origin requests to the remote api please give values to 
  2188  `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
  2189  default or blank means CORS disabled
  2190  
  2191      $ docker -d -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"