Browse code

Bump API Version to v1.23

Signed-off-by: Tibor Vass <tibor@docker.com>

Tibor Vass authored on 2016/01/16 00:38:33
Showing 3 changed files
... ...
@@ -18,7 +18,7 @@ import (
18 18
 // Common constants for daemon and client.
19 19
 const (
20 20
 	// Version of Current REST API
21
-	DefaultVersion version.Version = "1.22"
21
+	DefaultVersion version.Version = "1.23"
22 22
 
23 23
 	// MinVersion represents Minimum REST API version supported
24 24
 	MinVersion version.Version = "1.12"
... ...
@@ -24,14 +24,15 @@ client must have `root` access to interact with the daemon. If a group named
24 24
 `docker` exists on your system, `docker` applies ownership of the socket to the
25 25
 group.
26 26
 
27
-The current version of the API is v1.22 which means calling `/info` is the same
28
-as calling `/v1.22/info`. To call an older version of the API use
29
-`/v1.21/info`.
27
+The current version of the API is v1.23 which means calling `/info` is the same
28
+as calling `/v1.23/info`. To call an older version of the API use
29
+`/v1.22/info`.
30 30
 
31 31
 Use the table below to find the API version for a Docker version:
32 32
 
33 33
 Docker version  | API version                        | Changes
34 34
 ----------------|------------------------------------|------------------------------------------------------
35
+1.11.x          | [1.23](docker_remote_api_v1.23.md) | [API changes](docker_remote_api.md#v1-23-api-changes)
35 36
 1.10.x          | [1.22](docker_remote_api_v1.22.md) | [API changes](docker_remote_api.md#v1-22-api-changes)
36 37
 1.9.x           | [1.21](docker_remote_api_v1.21.md) | [API changes](docker_remote_api.md#v1-21-api-changes)
37 38
 1.8.x           | [1.20](docker_remote_api_v1.20.md) | [API changes](docker_remote_api.md#v1-20-api-changes)
... ...
@@ -91,6 +92,11 @@ Running `docker rmi` emits an **untag** event when removing an image name.  The
91 91
 
92 92
 This section lists each version from latest to oldest.  Each listing includes a link to the full documentation set and the changes relevant in that release.
93 93
 
94
+### v1.23 API changes
95
+
96
+[Docker Remote API v1.23](docker_remote_api_v1.23.md) documentation
97
+
98
+
94 99
 ### v1.22 API changes
95 100
 
96 101
 [Docker Remote API v1.22](docker_remote_api_v1.22.md) documentation
97 102
new file mode 100644
... ...
@@ -0,0 +1,3176 @@
0
+<!--[metadata]>
1
+title = "Remote API v1.23"
2
+description = "API Documentation for Docker"
3
+keywords = ["API, Docker, rcli, REST,  documentation"]
4
+[menu.main]
5
+parent="smn_remoteapi"
6
+weight=-3
7
+<![end-metadata]-->
8
+
9
+# Docker Remote API v1.23
10
+
11
+## 1. Brief introduction
12
+
13
+ - The Remote API has replaced `rcli`.
14
+ - The daemon listens on `unix:///var/run/docker.sock` but you can
15
+   [Bind Docker to another host/port or a Unix socket](../../userguide/basics.md#bind-docker-to-another-host-port-or-a-unix-socket).
16
+ - The API tends to be REST. However, for some complex commands, like `attach`
17
+   or `pull`, the HTTP connection is hijacked to transport `stdout`,
18
+   `stdin` and `stderr`.
19
+ - When the client API version is newer than the daemon's, these calls return an HTTP
20
+   `400 Bad Request` error message.
21
+
22
+# 2. Endpoints
23
+
24
+## 2.1 Containers
25
+
26
+### List containers
27
+
28
+`GET /containers/json`
29
+
30
+List containers
31
+
32
+**Example request**:
33
+
34
+    GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
35
+
36
+**Example response**:
37
+
38
+    HTTP/1.1 200 OK
39
+    Content-Type: application/json
40
+
41
+    [
42
+         {
43
+                 "Id": "8dfafdbc3a40",
44
+                 "Names":["/boring_feynman"],
45
+                 "Image": "ubuntu:latest",
46
+                 "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
47
+                 "Command": "echo 1",
48
+                 "Created": 1367854155,
49
+                 "Status": "Exit 0",
50
+                 "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
51
+                 "Labels": {
52
+                         "com.example.vendor": "Acme",
53
+                         "com.example.license": "GPL",
54
+                         "com.example.version": "1.0"
55
+                 },
56
+                 "SizeRw": 12288,
57
+                 "SizeRootFs": 0,
58
+                 "NetworkSettings": {
59
+                         "Networks": {
60
+                                 "bridge": {
61
+                                          "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
62
+                                          "EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f",
63
+                                          "Gateway": "172.17.0.1",
64
+                                          "IPAddress": "172.17.0.2",
65
+                                          "IPPrefixLen": 16,
66
+                                          "IPv6Gateway": "",
67
+                                          "GlobalIPv6Address": "",
68
+                                          "GlobalIPv6PrefixLen": 0,
69
+                                          "MacAddress": "02:42:ac:11:00:02"
70
+                                  }
71
+                         }
72
+                 }
73
+         },
74
+         {
75
+                 "Id": "9cd87474be90",
76
+                 "Names":["/coolName"],
77
+                 "Image": "ubuntu:latest",
78
+                 "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
79
+                 "Command": "echo 222222",
80
+                 "Created": 1367854155,
81
+                 "Status": "Exit 0",
82
+                 "Ports": [],
83
+                 "Labels": {},
84
+                 "SizeRw": 12288,
85
+                 "SizeRootFs": 0,
86
+                 "NetworkSettings": {
87
+                         "Networks": {
88
+                                 "bridge": {
89
+                                          "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
90
+                                          "EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a",
91
+                                          "Gateway": "172.17.0.1",
92
+                                          "IPAddress": "172.17.0.8",
93
+                                          "IPPrefixLen": 16,
94
+                                          "IPv6Gateway": "",
95
+                                          "GlobalIPv6Address": "",
96
+                                          "GlobalIPv6PrefixLen": 0,
97
+                                          "MacAddress": "02:42:ac:11:00:08"
98
+                                  }
99
+                         }
100
+                 }
101
+
102
+         },
103
+         {
104
+                 "Id": "3176a2479c92",
105
+                 "Names":["/sleepy_dog"],
106
+                 "Image": "ubuntu:latest",
107
+                 "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
108
+                 "Command": "echo 3333333333333333",
109
+                 "Created": 1367854154,
110
+                 "Status": "Exit 0",
111
+                 "Ports":[],
112
+                 "Labels": {},
113
+                 "SizeRw":12288,
114
+                 "SizeRootFs":0,
115
+                 "NetworkSettings": {
116
+                         "Networks": {
117
+                                 "bridge": {
118
+                                          "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
119
+                                          "EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d",
120
+                                          "Gateway": "172.17.0.1",
121
+                                          "IPAddress": "172.17.0.6",
122
+                                          "IPPrefixLen": 16,
123
+                                          "IPv6Gateway": "",
124
+                                          "GlobalIPv6Address": "",
125
+                                          "GlobalIPv6PrefixLen": 0,
126
+                                          "MacAddress": "02:42:ac:11:00:06"
127
+                                  }
128
+                         }
129
+                 }
130
+
131
+         },
132
+         {
133
+                 "Id": "4cb07b47f9fb",
134
+                 "Names":["/running_cat"],
135
+                 "Image": "ubuntu:latest",
136
+                 "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
137
+                 "Command": "echo 444444444444444444444444444444444",
138
+                 "Created": 1367854152,
139
+                 "Status": "Exit 0",
140
+                 "Ports": [],
141
+                 "Labels": {},
142
+                 "SizeRw": 12288,
143
+                 "SizeRootFs": 0,
144
+                 "NetworkSettings": {
145
+                         "Networks": {
146
+                                 "bridge": {
147
+                                          "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
148
+                                          "EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9",
149
+                                          "Gateway": "172.17.0.1",
150
+                                          "IPAddress": "172.17.0.5",
151
+                                          "IPPrefixLen": 16,
152
+                                          "IPv6Gateway": "",
153
+                                          "GlobalIPv6Address": "",
154
+                                          "GlobalIPv6PrefixLen": 0,
155
+                                          "MacAddress": "02:42:ac:11:00:05"
156
+                                  }
157
+                         }
158
+                 }
159
+
160
+         }
161
+    ]
162
+
163
+Query Parameters:
164
+
165
+-   **all** – 1/True/true or 0/False/false, Show all containers.
166
+        Only running containers are shown by default (i.e., this defaults to false)
167
+-   **limit** – Show `limit` last created
168
+        containers, include non-running ones.
169
+-   **since** – Show only containers created since Id, include
170
+        non-running ones.
171
+-   **before** – Show only containers created before Id, include
172
+        non-running ones.
173
+-   **size** – 1/True/true or 0/False/false, Show the containers
174
+        sizes
175
+-   **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
176
+  -   `exited=<int>`; -- containers with exit code of  `<int>` ;
177
+  -   `status=`(`created`|`restarting`|`running`|`paused`|`exited`|`dead`)
178
+  -   `label=key` or `label="key=value"` of a container label
179
+  -   `isolation=`(`default`|`process`|`hyperv`)   (Windows daemon only)
180
+
181
+Status Codes:
182
+
183
+-   **200** – no error
184
+-   **400** – bad parameter
185
+-   **500** – server error
186
+
187
+### Create a container
188
+
189
+`POST /containers/create`
190
+
191
+Create a container
192
+
193
+**Example request**:
194
+
195
+    POST /containers/create HTTP/1.1
196
+    Content-Type: application/json
197
+
198
+    {
199
+           "Hostname": "",
200
+           "Domainname": "",
201
+           "User": "",
202
+           "AttachStdin": false,
203
+           "AttachStdout": true,
204
+           "AttachStderr": true,
205
+           "Tty": false,
206
+           "OpenStdin": false,
207
+           "StdinOnce": false,
208
+           "Env": [
209
+                   "FOO=bar",
210
+                   "BAZ=quux"
211
+           ],
212
+           "Cmd": [
213
+                   "date"
214
+           ],
215
+           "Entrypoint": "",
216
+           "Image": "ubuntu",
217
+           "Labels": {
218
+                   "com.example.vendor": "Acme",
219
+                   "com.example.license": "GPL",
220
+                   "com.example.version": "1.0"
221
+           },
222
+           "Mounts": [
223
+             {
224
+               "Name": "fac362...80535",
225
+               "Source": "/data",
226
+               "Destination": "/data",
227
+               "Driver": "local",
228
+               "Mode": "ro,Z",
229
+               "RW": false,
230
+               "Propagation": ""
231
+             }
232
+           ],
233
+           "WorkingDir": "",
234
+           "NetworkDisabled": false,
235
+           "MacAddress": "12:34:56:78:9a:bc",
236
+           "ExposedPorts": {
237
+                   "22/tcp": {}
238
+           },
239
+           "StopSignal": "SIGTERM",
240
+           "HostConfig": {
241
+             "Binds": ["/tmp:/tmp"],
242
+             "Links": ["redis3:redis"],
243
+             "Memory": 0,
244
+             "MemorySwap": 0,
245
+             "MemoryReservation": 0,
246
+             "KernelMemory": 0,
247
+             "CpuShares": 512,
248
+             "CpuPeriod": 100000,
249
+             "CpuQuota": 50000,
250
+             "CpusetCpus": "0,1",
251
+             "CpusetMems": "0,1",
252
+             "BlkioWeight": 300,
253
+             "BlkioWeightDevice": [{}],
254
+             "BlkioDeviceReadBps": [{}],
255
+             "BlkioDeviceReadIOps": [{}],
256
+             "BlkioDeviceWriteBps": [{}],
257
+             "BlkioDeviceWriteIOps": [{}],
258
+             "MemorySwappiness": 60,
259
+             "OomKillDisable": false,
260
+             "OomScoreAdj": 500,
261
+             "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
262
+             "PublishAllPorts": false,
263
+             "Privileged": false,
264
+             "ReadonlyRootfs": false,
265
+             "Dns": ["8.8.8.8"],
266
+             "DnsOptions": [""],
267
+             "DnsSearch": [""],
268
+             "ExtraHosts": null,
269
+             "VolumesFrom": ["parent", "other:ro"],
270
+             "CapAdd": ["NET_ADMIN"],
271
+             "CapDrop": ["MKNOD"],
272
+             "GroupAdd": ["newgroup"],
273
+             "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
274
+             "NetworkMode": "bridge",
275
+             "Devices": [],
276
+             "Ulimits": [{}],
277
+             "LogConfig": { "Type": "json-file", "Config": {} },
278
+             "SecurityOpt": [""],
279
+             "CgroupParent": "",
280
+             "VolumeDriver": "",
281
+             "ShmSize": 67108864
282
+          }
283
+      }
284
+
285
+**Example response**:
286
+
287
+      HTTP/1.1 201 Created
288
+      Content-Type: application/json
289
+
290
+      {
291
+           "Id":"e90e34656806",
292
+           "Warnings":[]
293
+      }
294
+
295
+Json Parameters:
296
+
297
+-   **Hostname** - A string value containing the hostname to use for the
298
+      container.
299
+-   **Domainname** - A string value containing the domain name to use
300
+      for the container.
301
+-   **User** - A string value specifying the user inside the container.
302
+-   **Memory** - Memory limit in bytes.
303
+-   **MemorySwap** - Total memory limit (memory + swap); set `-1` to disable swap
304
+      You must use this with `memory` and make the swap value larger than `memory`.
305
+-   **MemoryReservation** - Memory soft limit in bytes.
306
+-   **KernelMemory** - Kernel memory limit in bytes.
307
+-   **CpuShares** - An integer value containing the container's CPU Shares
308
+      (ie. the relative weight vs other containers).
309
+-   **CpuPeriod** - The length of a CPU period in microseconds.
310
+-   **CpuQuota** - Microseconds of CPU time that the container can get in a CPU period.
311
+-   **Cpuset** - Deprecated please don't use. Use `CpusetCpus` instead.
312
+-   **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
313
+-   **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
314
+-   **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
315
+-   **BlkioWeightDevice** - Block IO weight (relative device weight) in the form of:        `"BlkioWeightDevice": [{"Path": "device_path", "Weight": weight}]`
316
+-   **BlkioDeviceReadBps** - Limit read rate (bytes per second) from a device in the form of:	`"BlkioDeviceReadBps": [{"Path": "device_path", "Rate": rate}]`, for example:
317
+	`"BlkioDeviceReadBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
318
+-   **BlkioDeviceWriteBps** - Limit write rate (bytes per second) to a device in the form of:	`"BlkioDeviceWriteBps": [{"Path": "device_path", "Rate": rate}]`, for example:
319
+	`"BlkioDeviceWriteBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
320
+-   **BlkioDeviceReadIOps** - Limit read rate (IO per second) from a device in the form of:	`"BlkioDeviceReadIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
321
+	`"BlkioDeviceReadIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
322
+-   **BlkioDeviceWiiteIOps** - Limit write rate (IO per second) to a device in the form of:	`"BlkioDeviceWriteIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
323
+	`"BlkioDeviceWriteIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
324
+-   **MemorySwappiness** - Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
325
+-   **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
326
+-   **OomScoreAdj** - An integer value containing the score given to the container in order to tune OOM killer preferences.
327
+-   **AttachStdin** - Boolean value, attaches to `stdin`.
328
+-   **AttachStdout** - Boolean value, attaches to `stdout`.
329
+-   **AttachStderr** - Boolean value, attaches to `stderr`.
330
+-   **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
331
+-   **OpenStdin** - Boolean value, opens stdin,
332
+-   **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
333
+-   **Env** - A list of environment variables in the form of `["VAR=value"[,"VAR2=value2"]]`
334
+-   **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value"[,"key2":"value2"]}`
335
+-   **Cmd** - Command to run specified as a string or an array of strings.
336
+-   **Entrypoint** - Set the entry point for the container as a string or an array
337
+      of strings.
338
+-   **Image** - A string specifying the image name to use for the container.
339
+-   **Mounts** - An array of mount points in the container.
340
+-   **WorkingDir** - A string specifying the working directory for commands to
341
+      run in.
342
+-   **NetworkDisabled** - Boolean value, when true disables networking for the
343
+      container
344
+-   **ExposedPorts** - An object mapping ports to an empty object in the form of:
345
+      `"ExposedPorts": { "<port>/<tcp|udp>: {}" }`
346
+-   **StopSignal** - Signal to stop a container as a string or unsigned integer. `SIGTERM` by default.
347
+-   **HostConfig**
348
+    -   **Binds** – A list of volume bindings for this container. Each volume binding is a string in one of these forms:
349
+           + `container_path` to create a new volume for the container
350
+           + `host_path:container_path` to bind-mount a host path into the container
351
+           + `host_path:container_path:ro` to make the bind-mount read-only inside the container.
352
+           + `volume_name:container_path` to bind-mount a volume managed by a volume plugin into the container.
353
+           + `volume_name:container_path:ro` to make the bind mount read-only inside the container.
354
+    -   **Links** - A list of links for the container. Each link entry should be
355
+          in the form of `container_name:alias`.
356
+    -   **PortBindings** - A map of exposed container ports and the host port they
357
+          should map to. A JSON object in the form
358
+          `{ <port>/<protocol>: [{ "HostPort": "<port>" }] }`
359
+          Take note that `port` is specified as a string and not an integer value.
360
+    -   **PublishAllPorts** - Allocates a random host port for all of a container's
361
+          exposed ports. Specified as a boolean value.
362
+    -   **Privileged** - Gives the container full access to the host. Specified as
363
+          a boolean value.
364
+    -   **ReadonlyRootfs** - Mount the container's root filesystem as read only.
365
+          Specified as a boolean value.
366
+    -   **Dns** - A list of DNS servers for the container to use.
367
+    -   **DnsOptions** - A list of DNS options
368
+    -   **DnsSearch** - A list of DNS search domains
369
+    -   **ExtraHosts** - A list of hostnames/IP mappings to add to the
370
+        container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
371
+    -   **VolumesFrom** - A list of volumes to inherit from another container.
372
+          Specified in the form `<container name>[:<ro|rw>]`
373
+    -   **CapAdd** - A list of kernel capabilities to add to the container.
374
+    -   **Capdrop** - A list of kernel capabilities to drop from the container.
375
+    -   **GroupAdd** - A list of additional groups that the container process will run as
376
+    -   **RestartPolicy** – The behavior to apply when the container exits.  The
377
+            value is an object with a `Name` property of either `"always"` to
378
+            always restart, `"unless-stopped"` to restart always except when
379
+            user has manually stopped the container or `"on-failure"` to restart only when the container
380
+            exit code is non-zero.  If `on-failure` is used, `MaximumRetryCount`
381
+            controls the number of times to retry before giving up.
382
+            The default is not to restart. (optional)
383
+            An ever increasing delay (double the previous delay, starting at 100mS)
384
+            is added before each restart to prevent flooding the server.
385
+    -   **NetworkMode** - Sets the networking mode for the container. Supported
386
+          values are: `bridge`, `host`, and `container:<name|id>`
387
+    -   **Devices** - A list of devices to add to the container specified as a JSON object in the
388
+      form
389
+          `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
390
+    -   **Ulimits** - A list of ulimits to set in the container, specified as
391
+          `{ "Name": <name>, "Soft": <soft limit>, "Hard": <hard limit> }`, for example:
392
+          `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
393
+    -   **SecurityOpt**: A list of string values to customize labels for MLS
394
+        systems, such as SELinux.
395
+    -   **LogConfig** - Log configuration for the container, specified as a JSON object in the form
396
+          `{ "Type": "<driver_name>", "Config": {"key1": "val1"}}`.
397
+          Available types: `json-file`, `syslog`, `journald`, `gelf`, `awslogs`, `splunk`, `none`.
398
+          `json-file` logging driver.
399
+    -   **CgroupParent** - Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.
400
+    -   **VolumeDriver** - Driver that this container users to mount volumes.
401
+    -   **ShmSize** - Size of `/dev/shm` in bytes. The size must be greater than 0.  If omitted the system uses 64MB.
402
+
403
+Query Parameters:
404
+
405
+-   **name** – Assign the specified name to the container. Must
406
+    match `/?[a-zA-Z0-9_-]+`.
407
+
408
+Status Codes:
409
+
410
+-   **201** – no error
411
+-   **404** – no such container
412
+-   **406** – impossible to attach (container not running)
413
+-   **500** – server error
414
+
415
+### Inspect a container
416
+
417
+`GET /containers/(id)/json`
418
+
419
+Return low-level information on the container `id`
420
+
421
+
422
+**Example request**:
423
+
424
+      GET /containers/4fa6e0f0c678/json HTTP/1.1
425
+
426
+**Example response**:
427
+
428
+    HTTP/1.1 200 OK
429
+    Content-Type: application/json
430
+
431
+    {
432
+		"AppArmorProfile": "",
433
+		"Args": [
434
+			"-c",
435
+			"exit 9"
436
+		],
437
+		"Config": {
438
+			"AttachStderr": true,
439
+			"AttachStdin": false,
440
+			"AttachStdout": true,
441
+			"Cmd": [
442
+				"/bin/sh",
443
+				"-c",
444
+				"exit 9"
445
+			],
446
+			"Domainname": "",
447
+			"Entrypoint": null,
448
+			"Env": [
449
+				"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
450
+			],
451
+			"ExposedPorts": null,
452
+			"Hostname": "ba033ac44011",
453
+			"Image": "ubuntu",
454
+			"Labels": {
455
+				"com.example.vendor": "Acme",
456
+				"com.example.license": "GPL",
457
+				"com.example.version": "1.0"
458
+			},
459
+			"MacAddress": "",
460
+			"NetworkDisabled": false,
461
+			"OnBuild": null,
462
+			"OpenStdin": false,
463
+			"StdinOnce": false,
464
+			"Tty": false,
465
+			"User": "",
466
+			"Volumes": null,
467
+			"WorkingDir": "",
468
+			"StopSignal": "SIGTERM"
469
+		},
470
+		"Created": "2015-01-06T15:47:31.485331387Z",
471
+		"Driver": "devicemapper",
472
+		"ExecDriver": "native-0.2",
473
+		"ExecIDs": null,
474
+		"HostConfig": {
475
+			"Binds": null,
476
+			"BlkioWeight": 0,
477
+			"BlkioWeightDevice": [{}],
478
+			"BlkioDeviceReadBps": [{}],
479
+			"BlkioDeviceWriteBps": [{}],
480
+			"BlkioDeviceReadIOps": [{}],
481
+			"BlkioDeviceWriteIOps": [{}],
482
+			"CapAdd": null,
483
+			"CapDrop": null,
484
+			"ContainerIDFile": "",
485
+			"CpusetCpus": "",
486
+			"CpusetMems": "",
487
+			"CpuShares": 0,
488
+			"CpuPeriod": 100000,
489
+			"Devices": [],
490
+			"Dns": null,
491
+			"DnsOptions": null,
492
+			"DnsSearch": null,
493
+			"ExtraHosts": null,
494
+			"IpcMode": "",
495
+			"Links": null,
496
+			"LxcConf": [],
497
+			"Memory": 0,
498
+			"MemorySwap": 0,
499
+			"MemoryReservation": 0,
500
+			"KernelMemory": 0,
501
+			"OomKillDisable": false,
502
+			"OomScoreAdj": 500,
503
+			"NetworkMode": "bridge",
504
+			"PortBindings": {},
505
+			"Privileged": false,
506
+			"ReadonlyRootfs": false,
507
+			"PublishAllPorts": false,
508
+			"RestartPolicy": {
509
+				"MaximumRetryCount": 2,
510
+				"Name": "on-failure"
511
+			},
512
+			"LogConfig": {
513
+				"Config": null,
514
+				"Type": "json-file"
515
+			},
516
+			"SecurityOpt": null,
517
+			"VolumesFrom": null,
518
+			"Ulimits": [{}],
519
+			"VolumeDriver": "",
520
+			"ShmSize": 67108864
521
+		},
522
+		"HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
523
+		"HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
524
+		"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
525
+		"Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
526
+		"Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
527
+		"MountLabel": "",
528
+		"Name": "/boring_euclid",
529
+		"NetworkSettings": {
530
+			"Bridge": "",
531
+			"SandboxID": "",
532
+			"HairpinMode": false,
533
+			"LinkLocalIPv6Address": "",
534
+			"LinkLocalIPv6PrefixLen": 0,
535
+			"Ports": null,
536
+			"SandboxKey": "",
537
+			"SecondaryIPAddresses": null,
538
+			"SecondaryIPv6Addresses": null,
539
+			"EndpointID": "",
540
+			"Gateway": "",
541
+			"GlobalIPv6Address": "",
542
+			"GlobalIPv6PrefixLen": 0,
543
+			"IPAddress": "",
544
+			"IPPrefixLen": 0,
545
+			"IPv6Gateway": "",
546
+			"MacAddress": "",
547
+			"Networks": {
548
+				"bridge": {
549
+					"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
550
+					"EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
551
+					"Gateway": "172.17.0.1",
552
+					"IPAddress": "172.17.0.2",
553
+					"IPPrefixLen": 16,
554
+					"IPv6Gateway": "",
555
+					"GlobalIPv6Address": "",
556
+					"GlobalIPv6PrefixLen": 0,
557
+					"MacAddress": "02:42:ac:12:00:02"
558
+				}
559
+			}
560
+		},
561
+		"Path": "/bin/sh",
562
+		"ProcessLabel": "",
563
+		"ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
564
+		"RestartCount": 1,
565
+		"State": {
566
+			"Error": "",
567
+			"ExitCode": 9,
568
+			"FinishedAt": "2015-01-06T15:47:32.080254511Z",
569
+			"OOMKilled": false,
570
+			"Dead": false,
571
+			"Paused": false,
572
+			"Pid": 0,
573
+			"Restarting": false,
574
+			"Running": true,
575
+			"StartedAt": "2015-01-06T15:47:32.072697474Z",
576
+			"Status": "running"
577
+		},
578
+		"Mounts": [
579
+			{
580
+				"Name": "fac362...80535",
581
+				"Source": "/data",
582
+				"Destination": "/data",
583
+				"Driver": "local",
584
+				"Mode": "ro,Z",
585
+				"RW": false,
586
+				"Propagation": ""
587
+			}
588
+		]
589
+	}
590
+
591
+**Example request, with size information**:
592
+
593
+    GET /containers/4fa6e0f0c678/json?size=1 HTTP/1.1
594
+
595
+**Example response, with size information**:
596
+
597
+    HTTP/1.1 200 OK
598
+    Content-Type: application/json
599
+
600
+    {
601
+    ....
602
+    "SizeRw": 0,
603
+    "SizeRootFs": 972,
604
+    ....
605
+    }
606
+
607
+Query Parameters:
608
+
609
+-   **size** – 1/True/true or 0/False/false, return container size information. Default is `false`.
610
+
611
+Status Codes:
612
+
613
+-   **200** – no error
614
+-   **404** – no such container
615
+-   **500** – server error
616
+
617
+### List processes running inside a container
618
+
619
+`GET /containers/(id)/top`
620
+
621
+List processes running inside the container `id`. On Unix systems this
622
+is done by running the `ps` command. This endpoint is not
623
+supported on Windows.
624
+
625
+**Example request**:
626
+
627
+    GET /containers/4fa6e0f0c678/top HTTP/1.1
628
+
629
+**Example response**:
630
+
631
+    HTTP/1.1 200 OK
632
+    Content-Type: application/json
633
+
634
+    {
635
+       "Titles" : [
636
+         "UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
637
+       ],
638
+       "Processes" : [
639
+         [
640
+           "root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
641
+         ],
642
+         [
643
+           "root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
644
+         ]
645
+       ]
646
+    }
647
+
648
+**Example request**:
649
+
650
+    GET /containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
651
+
652
+**Example response**:
653
+
654
+    HTTP/1.1 200 OK
655
+    Content-Type: application/json
656
+
657
+    {
658
+      "Titles" : [
659
+        "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
660
+      ]
661
+      "Processes" : [
662
+        [
663
+          "root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
664
+        ],
665
+        [
666
+          "root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
667
+        ]
668
+      ],
669
+    }
670
+
671
+Query Parameters:
672
+
673
+-   **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
674
+
675
+Status Codes:
676
+
677
+-   **200** – no error
678
+-   **404** – no such container
679
+-   **500** – server error
680
+
681
+### Get container logs
682
+
683
+`GET /containers/(id)/logs`
684
+
685
+Get `stdout` and `stderr` logs from the container ``id``
686
+
687
+> **Note**:
688
+> This endpoint works only for containers with the `json-file` or `journald` logging drivers.
689
+
690
+**Example request**:
691
+
692
+     GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1&timestamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
693
+
694
+**Example response**:
695
+
696
+     HTTP/1.1 101 UPGRADED
697
+     Content-Type: application/vnd.docker.raw-stream
698
+     Connection: Upgrade
699
+     Upgrade: tcp
700
+
701
+     {{ STREAM }}
702
+
703
+Query Parameters:
704
+
705
+-   **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
706
+-   **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
707
+-   **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
708
+-   **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
709
+    will only output log-entries since that timestamp. Default: 0 (unfiltered)
710
+-   **timestamps** – 1/True/true or 0/False/false, print timestamps for
711
+        every log line. Default `false`.
712
+-   **tail** – Output specified number of lines at the end of logs: `all` or `<number>`. Default all.
713
+
714
+Status Codes:
715
+
716
+-   **101** – no error, hints proxy about hijacking
717
+-   **200** – no error, no upgrade header found
718
+-   **404** – no such container
719
+-   **500** – server error
720
+
721
+### Inspect changes on a container's filesystem
722
+
723
+`GET /containers/(id)/changes`
724
+
725
+Inspect changes on container `id`'s filesystem
726
+
727
+**Example request**:
728
+
729
+    GET /containers/4fa6e0f0c678/changes HTTP/1.1
730
+
731
+**Example response**:
732
+
733
+    HTTP/1.1 200 OK
734
+    Content-Type: application/json
735
+
736
+    [
737
+         {
738
+                 "Path": "/dev",
739
+                 "Kind": 0
740
+         },
741
+         {
742
+                 "Path": "/dev/kmsg",
743
+                 "Kind": 1
744
+         },
745
+         {
746
+                 "Path": "/test",
747
+                 "Kind": 1
748
+         }
749
+    ]
750
+
751
+Values for `Kind`:
752
+
753
+- `0`: Modify
754
+- `1`: Add
755
+- `2`: Delete
756
+
757
+Status Codes:
758
+
759
+-   **200** – no error
760
+-   **404** – no such container
761
+-   **500** – server error
762
+
763
+### Export a container
764
+
765
+`GET /containers/(id)/export`
766
+
767
+Export the contents of container `id`
768
+
769
+**Example request**:
770
+
771
+    GET /containers/4fa6e0f0c678/export HTTP/1.1
772
+
773
+**Example response**:
774
+
775
+    HTTP/1.1 200 OK
776
+    Content-Type: application/octet-stream
777
+
778
+    {{ TAR STREAM }}
779
+
780
+Status Codes:
781
+
782
+-   **200** – no error
783
+-   **404** – no such container
784
+-   **500** – server error
785
+
786
+### Get container stats based on resource usage
787
+
788
+`GET /containers/(id)/stats`
789
+
790
+This endpoint returns a live stream of a container's resource usage statistics.
791
+
792
+**Example request**:
793
+
794
+    GET /containers/redis1/stats HTTP/1.1
795
+
796
+**Example response**:
797
+
798
+      HTTP/1.1 200 OK
799
+      Content-Type: application/json
800
+
801
+      {
802
+         "read" : "2015-01-08T22:57:31.547920715Z",
803
+         "networks": {
804
+                 "eth0": {
805
+                     "rx_bytes": 5338,
806
+                     "rx_dropped": 0,
807
+                     "rx_errors": 0,
808
+                     "rx_packets": 36,
809
+                     "tx_bytes": 648,
810
+                     "tx_dropped": 0,
811
+                     "tx_errors": 0,
812
+                     "tx_packets": 8
813
+                 },
814
+                 "eth5": {
815
+                     "rx_bytes": 4641,
816
+                     "rx_dropped": 0,
817
+                     "rx_errors": 0,
818
+                     "rx_packets": 26,
819
+                     "tx_bytes": 690,
820
+                     "tx_dropped": 0,
821
+                     "tx_errors": 0,
822
+                     "tx_packets": 9
823
+                 }
824
+         },
825
+         "memory_stats" : {
826
+            "stats" : {
827
+               "total_pgmajfault" : 0,
828
+               "cache" : 0,
829
+               "mapped_file" : 0,
830
+               "total_inactive_file" : 0,
831
+               "pgpgout" : 414,
832
+               "rss" : 6537216,
833
+               "total_mapped_file" : 0,
834
+               "writeback" : 0,
835
+               "unevictable" : 0,
836
+               "pgpgin" : 477,
837
+               "total_unevictable" : 0,
838
+               "pgmajfault" : 0,
839
+               "total_rss" : 6537216,
840
+               "total_rss_huge" : 6291456,
841
+               "total_writeback" : 0,
842
+               "total_inactive_anon" : 0,
843
+               "rss_huge" : 6291456,
844
+               "hierarchical_memory_limit" : 67108864,
845
+               "total_pgfault" : 964,
846
+               "total_active_file" : 0,
847
+               "active_anon" : 6537216,
848
+               "total_active_anon" : 6537216,
849
+               "total_pgpgout" : 414,
850
+               "total_cache" : 0,
851
+               "inactive_anon" : 0,
852
+               "active_file" : 0,
853
+               "pgfault" : 964,
854
+               "inactive_file" : 0,
855
+               "total_pgpgin" : 477
856
+            },
857
+            "max_usage" : 6651904,
858
+            "usage" : 6537216,
859
+            "failcnt" : 0,
860
+            "limit" : 67108864
861
+         },
862
+         "blkio_stats" : {},
863
+         "cpu_stats" : {
864
+            "cpu_usage" : {
865
+               "percpu_usage" : [
866
+                  16970827,
867
+                  1839451,
868
+                  7107380,
869
+                  10571290
870
+               ],
871
+               "usage_in_usermode" : 10000000,
872
+               "total_usage" : 36488948,
873
+               "usage_in_kernelmode" : 20000000
874
+            },
875
+            "system_cpu_usage" : 20091722000000000,
876
+            "throttling_data" : {}
877
+         }
878
+      }
879
+
880
+Query Parameters:
881
+
882
+-   **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
883
+
884
+Status Codes:
885
+
886
+-   **200** – no error
887
+-   **404** – no such container
888
+-   **500** – server error
889
+
890
+### Resize a container TTY
891
+
892
+`POST /containers/(id)/resize`
893
+
894
+Resize the TTY for container with  `id`. The unit is number of characters. You must restart the container for the resize to take effect.
895
+
896
+**Example request**:
897
+
898
+      POST /containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
899
+
900
+**Example response**:
901
+
902
+      HTTP/1.1 200 OK
903
+      Content-Length: 0
904
+      Content-Type: text/plain; charset=utf-8
905
+
906
+Query Parameters:
907
+
908
+-   **h** – height of `tty` session
909
+-   **w** – width
910
+
911
+Status Codes:
912
+
913
+-   **200** – no error
914
+-   **404** – No such container
915
+-   **500** – Cannot resize container
916
+
917
+### Start a container
918
+
919
+`POST /containers/(id)/start`
920
+
921
+Start the container `id`
922
+
923
+> **Note**:
924
+> For backwards compatibility, this endpoint accepts a `HostConfig` as JSON-encoded request body.
925
+> See [create a container](#create-a-container) for details.
926
+
927
+**Example request**:
928
+
929
+    POST /containers/(id)/start HTTP/1.1
930
+
931
+**Example response**:
932
+
933
+    HTTP/1.1 204 No Content
934
+
935
+Query Parameters:
936
+
937
+-   **detachKeys** – Override the key sequence for detaching a
938
+        container. Format is a single character `[a-Z]` or `ctrl-<value>`
939
+        where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
940
+
941
+Status Codes:
942
+
943
+-   **204** – no error
944
+-   **304** – container already started
945
+-   **404** – no such container
946
+-   **500** – server error
947
+
948
+### Stop a container
949
+
950
+`POST /containers/(id)/stop`
951
+
952
+Stop the container `id`
953
+
954
+**Example request**:
955
+
956
+    POST /containers/e90e34656806/stop?t=5 HTTP/1.1
957
+
958
+**Example response**:
959
+
960
+    HTTP/1.1 204 No Content
961
+
962
+Query Parameters:
963
+
964
+-   **t** – number of seconds to wait before killing the container
965
+
966
+Status Codes:
967
+
968
+-   **204** – no error
969
+-   **304** – container already stopped
970
+-   **404** – no such container
971
+-   **500** – server error
972
+
973
+### Restart a container
974
+
975
+`POST /containers/(id)/restart`
976
+
977
+Restart the container `id`
978
+
979
+**Example request**:
980
+
981
+    POST /containers/e90e34656806/restart?t=5 HTTP/1.1
982
+
983
+**Example response**:
984
+
985
+    HTTP/1.1 204 No Content
986
+
987
+Query Parameters:
988
+
989
+-   **t** – number of seconds to wait before killing the container
990
+
991
+Status Codes:
992
+
993
+-   **204** – no error
994
+-   **404** – no such container
995
+-   **500** – server error
996
+
997
+### Kill a container
998
+
999
+`POST /containers/(id)/kill`
1000
+
1001
+Kill the container `id`
1002
+
1003
+**Example request**:
1004
+
1005
+    POST /containers/e90e34656806/kill HTTP/1.1
1006
+
1007
+**Example response**:
1008
+
1009
+    HTTP/1.1 204 No Content
1010
+
1011
+Query Parameters
1012
+
1013
+-   **signal** - Signal to send to the container: integer or string like `SIGINT`.
1014
+        When not set, `SIGKILL` is assumed and the call waits for the container to exit.
1015
+
1016
+Status Codes:
1017
+
1018
+-   **204** – no error
1019
+-   **404** – no such container
1020
+-   **500** – server error
1021
+
1022
+### Update a container
1023
+
1024
+`POST /containers/(id)/update`
1025
+
1026
+Update resource configs of one or more containers.
1027
+
1028
+**Example request**:
1029
+
1030
+       POST /containers/(id)/update HTTP/1.1
1031
+       Content-Type: application/json
1032
+
1033
+       {
1034
+           "UpdateConfig": {
1035
+               "Resources": {
1036
+                   "BlkioWeight": 300,
1037
+                   "CpuShares": 512,
1038
+                   "CpuPeriod": 100000,
1039
+                   "CpuQuota": 50000,
1040
+                   "CpusetCpus": "0,1",
1041
+                   "CpusetMems": "0",
1042
+                   "Memory": 314572800,
1043
+                   "MemorySwap": 514288000,
1044
+                   "MemoryReservation": 209715200,
1045
+                   "KernelMemory": 52428800,
1046
+               }
1047
+           }
1048
+       }
1049
+
1050
+**Example response**:
1051
+
1052
+       HTTP/1.1 200 OK
1053
+       Content-Type: application/json
1054
+
1055
+       {
1056
+           "Warnings": []
1057
+       }
1058
+
1059
+Status Codes:
1060
+
1061
+-   **200** – no error
1062
+-   **400** – bad parameter
1063
+-   **404** – no such container
1064
+-   **500** – server error
1065
+
1066
+### Rename a container
1067
+
1068
+`POST /containers/(id)/rename`
1069
+
1070
+Rename the container `id` to a `new_name`
1071
+
1072
+**Example request**:
1073
+
1074
+    POST /containers/e90e34656806/rename?name=new_name HTTP/1.1
1075
+
1076
+**Example response**:
1077
+
1078
+    HTTP/1.1 204 No Content
1079
+
1080
+Query Parameters:
1081
+
1082
+-   **name** – new name for the container
1083
+
1084
+Status Codes:
1085
+
1086
+-   **204** – no error
1087
+-   **404** – no such container
1088
+-   **409** - conflict name already assigned
1089
+-   **500** – server error
1090
+
1091
+### Pause a container
1092
+
1093
+`POST /containers/(id)/pause`
1094
+
1095
+Pause the container `id`
1096
+
1097
+**Example request**:
1098
+
1099
+    POST /containers/e90e34656806/pause HTTP/1.1
1100
+
1101
+**Example response**:
1102
+
1103
+    HTTP/1.1 204 No Content
1104
+
1105
+Status Codes:
1106
+
1107
+-   **204** – no error
1108
+-   **404** – no such container
1109
+-   **500** – server error
1110
+
1111
+### Unpause a container
1112
+
1113
+`POST /containers/(id)/unpause`
1114
+
1115
+Unpause the container `id`
1116
+
1117
+**Example request**:
1118
+
1119
+    POST /containers/e90e34656806/unpause HTTP/1.1
1120
+
1121
+**Example response**:
1122
+
1123
+    HTTP/1.1 204 No Content
1124
+
1125
+Status Codes:
1126
+
1127
+-   **204** – no error
1128
+-   **404** – no such container
1129
+-   **500** – server error
1130
+
1131
+### Attach to a container
1132
+
1133
+`POST /containers/(id)/attach`
1134
+
1135
+Attach to the container `id`
1136
+
1137
+**Example request**:
1138
+
1139
+    POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
1140
+
1141
+**Example response**:
1142
+
1143
+    HTTP/1.1 101 UPGRADED
1144
+    Content-Type: application/vnd.docker.raw-stream
1145
+    Connection: Upgrade
1146
+    Upgrade: tcp
1147
+
1148
+    {{ STREAM }}
1149
+
1150
+Query Parameters:
1151
+
1152
+-   **detachKeys** – Override the key sequence for detaching a
1153
+        container. Format is a single character `[a-Z]` or `ctrl-<value>`
1154
+        where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
1155
+-   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
1156
+-   **stream** – 1/True/true or 0/False/false, return stream.
1157
+        Default `false`.
1158
+-   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
1159
+        to `stdin`. Default `false`.
1160
+-   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
1161
+        `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
1162
+-   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
1163
+        `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
1164
+
1165
+Status Codes:
1166
+
1167
+-   **101** – no error, hints proxy about hijacking
1168
+-   **200** – no error, no upgrade header found
1169
+-   **400** – bad parameter
1170
+-   **404** – no such container
1171
+-   **500** – server error
1172
+
1173
+    **Stream details**:
1174
+
1175
+    When using the TTY setting is enabled in
1176
+    [`POST /containers/create`
1177
+    ](#create-a-container),
1178
+    the stream is the raw data from the process PTY and client's `stdin`.
1179
+    When the TTY is disabled, then the stream is multiplexed to separate
1180
+    `stdout` and `stderr`.
1181
+
1182
+    The format is a **Header** and a **Payload** (frame).
1183
+
1184
+    **HEADER**
1185
+
1186
+    The header contains the information which the stream writes (`stdout` or
1187
+    `stderr`). It also contains the size of the associated frame encoded in the
1188
+    last four bytes (`uint32`).
1189
+
1190
+    It is encoded on the first eight bytes like this:
1191
+
1192
+        header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
1193
+
1194
+    `STREAM_TYPE` can be:
1195
+
1196
+-   0: `stdin` (is written on `stdout`)
1197
+-   1: `stdout`
1198
+-   2: `stderr`
1199
+
1200
+    `SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
1201
+    the `uint32` size encoded as big endian.
1202
+
1203
+    **PAYLOAD**
1204
+
1205
+    The payload is the raw stream.
1206
+
1207
+    **IMPLEMENTATION**
1208
+
1209
+    The simplest way to implement the Attach protocol is the following:
1210
+
1211
+    1.  Read eight bytes.
1212
+    2.  Choose `stdout` or `stderr` depending on the first byte.
1213
+    3.  Extract the frame size from the last four bytes.
1214
+    4.  Read the extracted size and output it on the correct output.
1215
+    5.  Goto 1.
1216
+
1217
+### Attach to a container (websocket)
1218
+
1219
+`GET /containers/(id)/attach/ws`
1220
+
1221
+Attach to the container `id` via websocket
1222
+
1223
+Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
1224
+
1225
+**Example request**
1226
+
1227
+    GET /containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
1228
+
1229
+**Example response**
1230
+
1231
+    {{ STREAM }}
1232
+
1233
+Query Parameters:
1234
+
1235
+-   **detachKeys** – Override the key sequence for detaching a
1236
+        container. Format is a single character `[a-Z]` or `ctrl-<value>`
1237
+        where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
1238
+-   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
1239
+-   **stream** – 1/True/true or 0/False/false, return stream.
1240
+        Default `false`.
1241
+-   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
1242
+        to `stdin`. Default `false`.
1243
+-   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
1244
+        `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
1245
+-   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
1246
+        `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
1247
+
1248
+Status Codes:
1249
+
1250
+-   **200** – no error
1251
+-   **400** – bad parameter
1252
+-   **404** – no such container
1253
+-   **500** – server error
1254
+
1255
+### Wait a container
1256
+
1257
+`POST /containers/(id)/wait`
1258
+
1259
+Block until container `id` stops, then returns the exit code
1260
+
1261
+**Example request**:
1262
+
1263
+    POST /containers/16253994b7c4/wait HTTP/1.1
1264
+
1265
+**Example response**:
1266
+
1267
+    HTTP/1.1 200 OK
1268
+    Content-Type: application/json
1269
+
1270
+    {"StatusCode": 0}
1271
+
1272
+Status Codes:
1273
+
1274
+-   **200** – no error
1275
+-   **404** – no such container
1276
+-   **500** – server error
1277
+
1278
+### Remove a container
1279
+
1280
+`DELETE /containers/(id)`
1281
+
1282
+Remove the container `id` from the filesystem
1283
+
1284
+**Example request**:
1285
+
1286
+    DELETE /containers/16253994b7c4?v=1 HTTP/1.1
1287
+
1288
+**Example response**:
1289
+
1290
+    HTTP/1.1 204 No Content
1291
+
1292
+Query Parameters:
1293
+
1294
+-   **v** – 1/True/true or 0/False/false, Remove the volumes
1295
+        associated to the container. Default `false`.
1296
+-   **force** - 1/True/true or 0/False/false, Kill then remove the container.
1297
+        Default `false`.
1298
+
1299
+Status Codes:
1300
+
1301
+-   **204** – no error
1302
+-   **400** – bad parameter
1303
+-   **404** – no such container
1304
+-   **500** – server error
1305
+
1306
+### Copy files or folders from a container
1307
+
1308
+`POST /containers/(id)/copy`
1309
+
1310
+Copy files or folders of container `id`
1311
+
1312
+**Deprecated** in favor of the `archive` endpoint below.
1313
+
1314
+**Example request**:
1315
+
1316
+    POST /containers/4fa6e0f0c678/copy HTTP/1.1
1317
+    Content-Type: application/json
1318
+
1319
+    {
1320
+         "Resource": "test.txt"
1321
+    }
1322
+
1323
+**Example response**:
1324
+
1325
+    HTTP/1.1 200 OK
1326
+    Content-Type: application/x-tar
1327
+
1328
+    {{ TAR STREAM }}
1329
+
1330
+Status Codes:
1331
+
1332
+-   **200** – no error
1333
+-   **404** – no such container
1334
+-   **500** – server error
1335
+
1336
+### Retrieving information about files and folders in a container
1337
+
1338
+`HEAD /containers/(id)/archive`
1339
+
1340
+See the description of the `X-Docker-Container-Path-Stat` header in the
1341
+following section.
1342
+
1343
+### Get an archive of a filesystem resource in a container
1344
+
1345
+`GET /containers/(id)/archive`
1346
+
1347
+Get an tar archive of a resource in the filesystem of container `id`.
1348
+
1349
+Query Parameters:
1350
+
1351
+- **path** - resource in the container's filesystem to archive. Required.
1352
+
1353
+    If not an absolute path, it is relative to the container's root directory.
1354
+    The resource specified by **path** must exist. To assert that the resource
1355
+    is expected to be a directory, **path** should end in `/` or  `/.`
1356
+    (assuming a path separator of `/`). If **path** ends in `/.` then this
1357
+    indicates that only the contents of the **path** directory should be
1358
+    copied. A symlink is always resolved to its target.
1359
+
1360
+    **Note**: It is not possible to copy certain system files such as resources
1361
+    under `/proc`, `/sys`, `/dev`, and mounts created by the user in the
1362
+    container.
1363
+
1364
+**Example request**:
1365
+
1366
+        GET /containers/8cce319429b2/archive?path=/root HTTP/1.1
1367
+
1368
+**Example response**:
1369
+
1370
+        HTTP/1.1 200 OK
1371
+        Content-Type: application/x-tar
1372
+        X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
1373
+
1374
+        {{ TAR STREAM }}
1375
+
1376
+On success, a response header `X-Docker-Container-Path-Stat` will be set to a
1377
+base64-encoded JSON object containing some filesystem header information about
1378
+the archived resource. The above example value would decode to the following
1379
+JSON object (whitespace added for readability):
1380
+
1381
+        {
1382
+            "name": "root",
1383
+            "size": 4096,
1384
+            "mode": 2147484096,
1385
+            "mtime": "2014-02-27T20:51:23Z",
1386
+            "linkTarget": ""
1387
+        }
1388
+
1389
+A `HEAD` request can also be made to this endpoint if only this information is
1390
+desired.
1391
+
1392
+Status Codes:
1393
+
1394
+- **200** - success, returns archive of copied resource
1395
+- **400** - client error, bad parameter, details in JSON response body, one of:
1396
+    - must specify path parameter (**path** cannot be empty)
1397
+    - not a directory (**path** was asserted to be a directory but exists as a
1398
+      file)
1399
+- **404** - client error, resource not found, one of:
1400
+    – no such container (container `id` does not exist)
1401
+    - no such file or directory (**path** does not exist)
1402
+- **500** - server error
1403
+
1404
+### Extract an archive of files or folders to a directory in a container
1405
+
1406
+`PUT /containers/(id)/archive`
1407
+
1408
+Upload a tar archive to be extracted to a path in the filesystem of container
1409
+`id`.
1410
+
1411
+Query Parameters:
1412
+
1413
+- **path** - path to a directory in the container
1414
+    to extract the archive's contents into. Required.
1415
+
1416
+    If not an absolute path, it is relative to the container's root directory.
1417
+    The **path** resource must exist.
1418
+- **noOverwriteDirNonDir** - If "1", "true", or "True" then it will be an error
1419
+    if unpacking the given content would cause an existing directory to be
1420
+    replaced with a non-directory and vice versa.
1421
+
1422
+**Example request**:
1423
+
1424
+    PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
1425
+    Content-Type: application/x-tar
1426
+
1427
+    {{ TAR STREAM }}
1428
+
1429
+**Example response**:
1430
+
1431
+    HTTP/1.1 200 OK
1432
+
1433
+Status Codes:
1434
+
1435
+- **200** – the content was extracted successfully
1436
+- **400** - client error, bad parameter, details in JSON response body, one of:
1437
+    - must specify path parameter (**path** cannot be empty)
1438
+    - not a directory (**path** should be a directory but exists as a file)
1439
+    - unable to overwrite existing directory with non-directory
1440
+      (if **noOverwriteDirNonDir**)
1441
+    - unable to overwrite existing non-directory with directory
1442
+      (if **noOverwriteDirNonDir**)
1443
+- **403** - client error, permission denied, the volume
1444
+    or container rootfs is marked as read-only.
1445
+- **404** - client error, resource not found, one of:
1446
+    – no such container (container `id` does not exist)
1447
+    - no such file or directory (**path** resource does not exist)
1448
+- **500** – server error
1449
+
1450
+## 2.2 Images
1451
+
1452
+### List Images
1453
+
1454
+`GET /images/json`
1455
+
1456
+**Example request**:
1457
+
1458
+    GET /images/json?all=0 HTTP/1.1
1459
+
1460
+**Example response**:
1461
+
1462
+    HTTP/1.1 200 OK
1463
+    Content-Type: application/json
1464
+
1465
+    [
1466
+      {
1467
+         "RepoTags": [
1468
+           "ubuntu:12.04",
1469
+           "ubuntu:precise",
1470
+           "ubuntu:latest"
1471
+         ],
1472
+         "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
1473
+         "Created": 1365714795,
1474
+         "Size": 131506275,
1475
+         "VirtualSize": 131506275,
1476
+         "Labels": {}
1477
+      },
1478
+      {
1479
+         "RepoTags": [
1480
+           "ubuntu:12.10",
1481
+           "ubuntu:quantal"
1482
+         ],
1483
+         "ParentId": "27cf784147099545",
1484
+         "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
1485
+         "Created": 1364102658,
1486
+         "Size": 24653,
1487
+         "VirtualSize": 180116135,
1488
+         "Labels": {
1489
+            "com.example.version": "v1"
1490
+         }
1491
+      }
1492
+    ]
1493
+
1494
+**Example request, with digest information**:
1495
+
1496
+    GET /images/json?digests=1 HTTP/1.1
1497
+
1498
+**Example response, with digest information**:
1499
+
1500
+    HTTP/1.1 200 OK
1501
+    Content-Type: application/json
1502
+
1503
+    [
1504
+      {
1505
+        "Created": 1420064636,
1506
+        "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
1507
+        "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
1508
+        "RepoDigests": [
1509
+          "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
1510
+        ],
1511
+        "RepoTags": [
1512
+          "localhost:5000/test/busybox:latest",
1513
+          "playdate:latest"
1514
+        ],
1515
+        "Size": 0,
1516
+        "VirtualSize": 2429728,
1517
+        "Labels": {}
1518
+      }
1519
+    ]
1520
+
1521
+The response shows a single image `Id` associated with two repositories
1522
+(`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
1523
+either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
1524
+`playdate:latest` to reference the image.
1525
+
1526
+You can also use `RepoDigests` values to reference an image. In this response,
1527
+the array has only one reference and that is to the
1528
+`localhost:5000/test/busybox` repository; the `playdate` repository has no
1529
+digest. You can reference this digest using the value:
1530
+`localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
1531
+
1532
+See the `docker run` and `docker build` commands for examples of digest and tag
1533
+references on the command line.
1534
+
1535
+Query Parameters:
1536
+
1537
+-   **all** – 1/True/true or 0/False/false, default false
1538
+-   **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
1539
+  -   `dangling=true`
1540
+  -   `label=key` or `label="key=value"` of an image label
1541
+-   **filter** - only return images with the specified name
1542
+
1543
+### Build image from a Dockerfile
1544
+
1545
+`POST /build`
1546
+
1547
+Build an image from a Dockerfile
1548
+
1549
+**Example request**:
1550
+
1551
+    POST /build HTTP/1.1
1552
+
1553
+    {{ TAR STREAM }}
1554
+
1555
+**Example response**:
1556
+
1557
+    HTTP/1.1 200 OK
1558
+    Content-Type: application/json
1559
+
1560
+    {"stream": "Step 1..."}
1561
+    {"stream": "..."}
1562
+    {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
1563
+
1564
+The input stream must be a `tar` archive compressed with one of the
1565
+following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
1566
+
1567
+The archive must include a build instructions file, typically called
1568
+`Dockerfile` at the archive's root. The `dockerfile` parameter may be
1569
+used to specify a different build instructions file. To do this, its value must be
1570
+the path to the alternate build instructions file to use.
1571
+
1572
+The archive may include any number of other files,
1573
+which are accessible in the build context (See the [*ADD build
1574
+command*](../../reference/builder.md#dockerbuilder)).
1575
+
1576
+The build is canceled if the client drops the connection by quitting
1577
+or being killed.
1578
+
1579
+Query Parameters:
1580
+
1581
+-   **dockerfile** - Path within the build context to the Dockerfile. This is
1582
+        ignored if `remote` is specified and points to an individual filename.
1583
+-   **t** – A name and optional tag to apply to the image in the `name:tag` format.
1584
+        If you omit the `tag` the default `latest` value is assumed.
1585
+        You can provide one or more `t` parameters.
1586
+-   **remote** – A Git repository URI or HTTP/HTTPS URI build source. If the
1587
+        URI specifies a filename, the file's contents are placed into a file
1588
+		called `Dockerfile`.
1589
+-   **q** – Suppress verbose build output.
1590
+-   **nocache** – Do not use the cache when building the image.
1591
+-   **pull** - Attempt to pull the image even if an older image exists locally.
1592
+-   **rm** - Remove intermediate containers after a successful build (default behavior).
1593
+-   **forcerm** - Always remove intermediate containers (includes `rm`).
1594
+-   **memory** - Set memory limit for build.
1595
+-   **memswap** - Total memory (memory + swap), `-1` to disable swap.
1596
+-   **cpushares** - CPU shares (relative weight).
1597
+-   **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
1598
+-   **cpuperiod** - The length of a CPU period in microseconds.
1599
+-   **cpuquota** - Microseconds of CPU time that the container can get in a CPU period.
1600
+-   **buildargs** – JSON map of string pairs for build-time variables. Users pass
1601
+        these values at build-time. Docker uses the `buildargs` as the environment
1602
+        context for command(s) run via the Dockerfile's `RUN` instruction or for
1603
+        variable expansion in other Dockerfile instructions. This is not meant for
1604
+        passing secret values. [Read more about the buildargs instruction](../../reference/builder.md#arg)
1605
+-   **shmsize** - Size of `/dev/shm` in bytes. The size must be greater than 0.  If omitted the system uses 64MB.
1606
+
1607
+    Request Headers:
1608
+
1609
+-   **Content-type** – Set to `"application/tar"`.
1610
+-   **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON
1611
+        object with the following structure:
1612
+
1613
+            {
1614
+                "docker.example.com": {
1615
+                    "username": "janedoe",
1616
+                    "password": "hunter2"
1617
+                },
1618
+                "https://index.docker.io/v1/": {
1619
+                    "username": "mobydock",
1620
+                    "password": "conta1n3rize14"
1621
+                }
1622
+            }
1623
+
1624
+        This object maps the hostname of a registry to an object containing the
1625
+        "username" and "password" for that registry. Multiple registries may
1626
+        be specified as the build may be based on an image requiring
1627
+        authentication to pull from any arbitrary registry. Only the registry
1628
+        domain name (and port if not the default "443") are required. However
1629
+        (for legacy reasons) the "official" Docker, Inc. hosted registry must
1630
+        be specified with both a "https://" prefix and a "/v1/" suffix even
1631
+        though Docker will prefer to use the v2 registry API.
1632
+
1633
+Status Codes:
1634
+
1635
+-   **200** – no error
1636
+-   **500** – server error
1637
+
1638
+### Create an image
1639
+
1640
+`POST /images/create`
1641
+
1642
+Create an image either by pulling it from the registry or by importing it
1643
+
1644
+**Example request**:
1645
+
1646
+    POST /images/create?fromImage=ubuntu HTTP/1.1
1647
+
1648
+**Example response**:
1649
+
1650
+    HTTP/1.1 200 OK
1651
+    Content-Type: application/json
1652
+
1653
+    {"status": "Pulling..."}
1654
+    {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
1655
+    {"error": "Invalid..."}
1656
+    ...
1657
+
1658
+When using this endpoint to pull an image from the registry, the
1659
+`X-Registry-Auth` header can be used to include
1660
+a base64-encoded AuthConfig object.
1661
+
1662
+Query Parameters:
1663
+
1664
+-   **fromImage** – Name of the image to pull. The name may include a tag or
1665
+        digest. This parameter may only be used when pulling an image.
1666
+        The pull is cancelled if the HTTP connection is closed.
1667
+-   **fromSrc** – Source to import.  The value may be a URL from which the image
1668
+        can be retrieved or `-` to read the image from the request body.
1669
+        This parameter may only be used when importing an image.
1670
+-   **repo** – Repository name given to an image when it is imported.
1671
+        The repo may include a tag. This parameter may only be used when importing
1672
+        an image.
1673
+-   **tag** – Tag or digest.
1674
+
1675
+    Request Headers:
1676
+
1677
+-   **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
1678
+    - Credential based login:
1679
+
1680
+        ```
1681
+    {
1682
+            "username": "jdoe",
1683
+            "password": "secret",
1684
+            "email": "jdoe@acme.com",
1685
+    }
1686
+        ```
1687
+
1688
+    - Token based login:
1689
+
1690
+        ```
1691
+    {
1692
+            "registrytoken": "9cbaf023786cd7..."
1693
+    }
1694
+        ```
1695
+
1696
+Status Codes:
1697
+
1698
+-   **200** – no error
1699
+-   **500** – server error
1700
+
1701
+
1702
+
1703
+### Inspect an image
1704
+
1705
+`GET /images/(name)/json`
1706
+
1707
+Return low-level information on the image `name`
1708
+
1709
+**Example request**:
1710
+
1711
+    GET /images/example/json HTTP/1.1
1712
+
1713
+**Example response**:
1714
+
1715
+    HTTP/1.1 200 OK
1716
+    Content-Type: application/json
1717
+
1718
+    {
1719
+       "Id" : "85f05633ddc1c50679be2b16a0479ab6f7637f8884e0cfe0f4d20e1ebb3d6e7c",
1720
+       "Container" : "cb91e48a60d01f1e27028b4fc6819f4f290b3cf12496c8176ec714d0d390984a",
1721
+       "Comment" : "",
1722
+       "Os" : "linux",
1723
+       "Architecture" : "amd64",
1724
+       "Parent" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
1725
+       "ContainerConfig" : {
1726
+          "Tty" : false,
1727
+          "Hostname" : "e611e15f9c9d",
1728
+          "Volumes" : null,
1729
+          "Domainname" : "",
1730
+          "AttachStdout" : false,
1731
+          "PublishService" : "",
1732
+          "AttachStdin" : false,
1733
+          "OpenStdin" : false,
1734
+          "StdinOnce" : false,
1735
+          "NetworkDisabled" : false,
1736
+          "OnBuild" : [],
1737
+          "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
1738
+          "User" : "",
1739
+          "WorkingDir" : "",
1740
+          "Entrypoint" : null,
1741
+          "MacAddress" : "",
1742
+          "AttachStderr" : false,
1743
+          "Labels" : {
1744
+             "com.example.license" : "GPL",
1745
+             "com.example.version" : "1.0",
1746
+             "com.example.vendor" : "Acme"
1747
+          },
1748
+          "Env" : [
1749
+             "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
1750
+          ],
1751
+          "ExposedPorts" : null,
1752
+          "Cmd" : [
1753
+             "/bin/sh",
1754
+             "-c",
1755
+             "#(nop) LABEL com.example.vendor=Acme com.example.license=GPL com.example.version=1.0"
1756
+          ]
1757
+       },
1758
+       "DockerVersion" : "1.9.0-dev",
1759
+       "VirtualSize" : 188359297,
1760
+       "Size" : 0,
1761
+       "Author" : "",
1762
+       "Created" : "2015-09-10T08:30:53.26995814Z",
1763
+       "GraphDriver" : {
1764
+          "Name" : "aufs",
1765
+          "Data" : null
1766
+       },
1767
+       "RepoDigests" : [
1768
+          "localhost:5000/test/busybox/example@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
1769
+       ],
1770
+       "RepoTags" : [
1771
+          "example:1.0",
1772
+          "example:latest",
1773
+          "example:stable"
1774
+       ],
1775
+       "Config" : {
1776
+          "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
1777
+          "NetworkDisabled" : false,
1778
+          "OnBuild" : [],
1779
+          "StdinOnce" : false,
1780
+          "PublishService" : "",
1781
+          "AttachStdin" : false,
1782
+          "OpenStdin" : false,
1783
+          "Domainname" : "",
1784
+          "AttachStdout" : false,
1785
+          "Tty" : false,
1786
+          "Hostname" : "e611e15f9c9d",
1787
+          "Volumes" : null,
1788
+          "Cmd" : [
1789
+             "/bin/bash"
1790
+          ],
1791
+          "ExposedPorts" : null,
1792
+          "Env" : [
1793
+             "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
1794
+          ],
1795
+          "Labels" : {
1796
+             "com.example.vendor" : "Acme",
1797
+             "com.example.version" : "1.0",
1798
+             "com.example.license" : "GPL"
1799
+          },
1800
+          "Entrypoint" : null,
1801
+          "MacAddress" : "",
1802
+          "AttachStderr" : false,
1803
+          "WorkingDir" : "",
1804
+          "User" : ""
1805
+       }
1806
+    }
1807
+
1808
+Status Codes:
1809
+
1810
+-   **200** – no error
1811
+-   **404** – no such image
1812
+-   **500** – server error
1813
+
1814
+### Get the history of an image
1815
+
1816
+`GET /images/(name)/history`
1817
+
1818
+Return the history of the image `name`
1819
+
1820
+**Example request**:
1821
+
1822
+    GET /images/ubuntu/history HTTP/1.1
1823
+
1824
+**Example response**:
1825
+
1826
+    HTTP/1.1 200 OK
1827
+    Content-Type: application/json
1828
+
1829
+    [
1830
+        {
1831
+            "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
1832
+            "Created": 1398108230,
1833
+            "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
1834
+            "Tags": [
1835
+                "ubuntu:lucid",
1836
+                "ubuntu:10.04"
1837
+            ],
1838
+            "Size": 182964289,
1839
+            "Comment": ""
1840
+        },
1841
+        {
1842
+            "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
1843
+            "Created": 1398108222,
1844
+            "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/",
1845
+            "Tags": null,
1846
+            "Size": 0,
1847
+            "Comment": ""
1848
+        },
1849
+        {
1850
+            "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
1851
+            "Created": 1371157430,
1852
+            "CreatedBy": "",
1853
+            "Tags": [
1854
+                "scratch12:latest",
1855
+                "scratch:latest"
1856
+            ],
1857
+            "Size": 0,
1858
+            "Comment": "Imported from -"
1859
+        }
1860
+    ]
1861
+
1862
+Status Codes:
1863
+
1864
+-   **200** – no error
1865
+-   **404** – no such image
1866
+-   **500** – server error
1867
+
1868
+### Push an image on the registry
1869
+
1870
+`POST /images/(name)/push`
1871
+
1872
+Push the image `name` on the registry
1873
+
1874
+**Example request**:
1875
+
1876
+    POST /images/test/push HTTP/1.1
1877
+
1878
+**Example response**:
1879
+
1880
+    HTTP/1.1 200 OK
1881
+    Content-Type: application/json
1882
+
1883
+    {"status": "Pushing..."}
1884
+    {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
1885
+    {"error": "Invalid..."}
1886
+    ...
1887
+
1888
+If you wish to push an image on to a private registry, that image must already have a tag
1889
+into a repository which references that registry `hostname` and `port`.  This repository name should
1890
+then be used in the URL. This duplicates the command line's flow.
1891
+
1892
+The push is cancelled if the HTTP connection is closed.
1893
+
1894
+**Example request**:
1895
+
1896
+    POST /images/registry.acme.com:5000/test/push HTTP/1.1
1897
+
1898
+
1899
+Query Parameters:
1900
+
1901
+-   **tag** – The tag to associate with the image on the registry. This is optional.
1902
+
1903
+Request Headers:
1904
+
1905
+-   **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
1906
+    - Credential based login:
1907
+
1908
+        ```
1909
+    {
1910
+            "username": "jdoe",
1911
+            "password": "secret",
1912
+            "email": "jdoe@acme.com",
1913
+    }
1914
+        ```
1915
+
1916
+    - Token based login:
1917
+
1918
+        ```
1919
+    {
1920
+            "registrytoken": "9cbaf023786cd7..."
1921
+    }
1922
+        ```
1923
+
1924
+Status Codes:
1925
+
1926
+-   **200** – no error
1927
+-   **404** – no such image
1928
+-   **500** – server error
1929
+
1930
+### Tag an image into a repository
1931
+
1932
+`POST /images/(name)/tag`
1933
+
1934
+Tag the image `name` into a repository
1935
+
1936
+**Example request**:
1937
+
1938
+    POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
1939
+
1940
+**Example response**:
1941
+
1942
+    HTTP/1.1 201 OK
1943
+
1944
+Query Parameters:
1945
+
1946
+-   **repo** – The repository to tag in
1947
+-   **force** – 1/True/true or 0/False/false, default false
1948
+-   **tag** - The new tag name
1949
+
1950
+Status Codes:
1951
+
1952
+-   **201** – no error
1953
+-   **400** – bad parameter
1954
+-   **404** – no such image
1955
+-   **409** – conflict
1956
+-   **500** – server error
1957
+
1958
+### Remove an image
1959
+
1960
+`DELETE /images/(name)`
1961
+
1962
+Remove the image `name` from the filesystem
1963
+
1964
+**Example request**:
1965
+
1966
+    DELETE /images/test HTTP/1.1
1967
+
1968
+**Example response**:
1969
+
1970
+    HTTP/1.1 200 OK
1971
+    Content-type: application/json
1972
+
1973
+    [
1974
+     {"Untagged": "3e2f21a89f"},
1975
+     {"Deleted": "3e2f21a89f"},
1976
+     {"Deleted": "53b4f83ac9"}
1977
+    ]
1978
+
1979
+Query Parameters:
1980
+
1981
+-   **force** – 1/True/true or 0/False/false, default false
1982
+-   **noprune** – 1/True/true or 0/False/false, default false
1983
+
1984
+Status Codes:
1985
+
1986
+-   **200** – no error
1987
+-   **404** – no such image
1988
+-   **409** – conflict
1989
+-   **500** – server error
1990
+
1991
+### Search images
1992
+
1993
+`GET /images/search`
1994
+
1995
+Search for an image on [Docker Hub](https://hub.docker.com).
1996
+
1997
+> **Note**:
1998
+> The response keys have changed from API v1.6 to reflect the JSON
1999
+> sent by the registry server to the docker daemon's request.
2000
+
2001
+**Example request**:
2002
+
2003
+    GET /images/search?term=sshd HTTP/1.1
2004
+
2005
+**Example response**:
2006
+
2007
+    HTTP/1.1 200 OK
2008
+    Content-Type: application/json
2009
+
2010
+    [
2011
+            {
2012
+                "description": "",
2013
+                "is_official": false,
2014
+                "is_automated": false,
2015
+                "name": "wma55/u1210sshd",
2016
+                "star_count": 0
2017
+            },
2018
+            {
2019
+                "description": "",
2020
+                "is_official": false,
2021
+                "is_automated": false,
2022
+                "name": "jdswinbank/sshd",
2023
+                "star_count": 0
2024
+            },
2025
+            {
2026
+                "description": "",
2027
+                "is_official": false,
2028
+                "is_automated": false,
2029
+                "name": "vgauthier/sshd",
2030
+                "star_count": 0
2031
+            }
2032
+    ...
2033
+    ]
2034
+
2035
+Query Parameters:
2036
+
2037
+-   **term** – term to search
2038
+
2039
+Status Codes:
2040
+
2041
+-   **200** – no error
2042
+-   **500** – server error
2043
+
2044
+## 2.3 Misc
2045
+
2046
+### Check auth configuration
2047
+
2048
+`POST /auth`
2049
+
2050
+Get the default username and email
2051
+
2052
+**Example request**:
2053
+
2054
+    POST /auth HTTP/1.1
2055
+    Content-Type: application/json
2056
+
2057
+    {
2058
+         "username":" hannibal",
2059
+         "password: "xxxx",
2060
+         "email": "hannibal@a-team.com",
2061
+         "serveraddress": "https://index.docker.io/v1/"
2062
+    }
2063
+
2064
+**Example response**:
2065
+
2066
+    HTTP/1.1 200 OK
2067
+
2068
+Status Codes:
2069
+
2070
+-   **200** – no error
2071
+-   **204** – no error
2072
+-   **500** – server error
2073
+
2074
+### Display system-wide information
2075
+
2076
+`GET /info`
2077
+
2078
+Display system-wide information
2079
+
2080
+**Example request**:
2081
+
2082
+    GET /info HTTP/1.1
2083
+
2084
+**Example response**:
2085
+
2086
+    HTTP/1.1 200 OK
2087
+    Content-Type: application/json
2088
+
2089
+    {
2090
+        "Architecture": "x86_64",
2091
+        "Containers": 11,
2092
+        "ContainersRunning": 7,
2093
+        "ContainersStopped": 3,
2094
+        "ContainersPaused": 1,
2095
+        "CpuCfsPeriod": true,
2096
+        "CpuCfsQuota": true,
2097
+        "Debug": false,
2098
+        "DiscoveryBackend": "etcd://localhost:2379",
2099
+        "DockerRootDir": "/var/lib/docker",
2100
+        "Driver": "btrfs",
2101
+        "DriverStatus": [[""]],
2102
+        "Plugins": {
2103
+            "Volume": [
2104
+                "local"
2105
+            ],
2106
+            "Network": [
2107
+                "null",
2108
+                "host",
2109
+                "bridge"
2110
+            ]
2111
+        },
2112
+        "ExecutionDriver": "native-0.1",
2113
+        "ExperimentalBuild": false,
2114
+        "HttpProxy": "http://test:test@localhost:8080",
2115
+        "HttpsProxy": "https://test:test@localhost:8080",
2116
+        "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
2117
+        "IPv4Forwarding": true,
2118
+        "Images": 16,
2119
+        "IndexServerAddress": "https://index.docker.io/v1/",
2120
+        "InitPath": "/usr/bin/docker",
2121
+        "InitSha1": "",
2122
+        "KernelVersion": "3.12.0-1-amd64",
2123
+        "Labels": [
2124
+            "storage=ssd"
2125
+        ],
2126
+        "MemTotal": 2099236864,
2127
+        "MemoryLimit": true,
2128
+        "NCPU": 1,
2129
+        "NEventsListener": 0,
2130
+        "NFd": 11,
2131
+        "NGoroutines": 21,
2132
+        "Name": "prod-server-42",
2133
+        "NoProxy": "9.81.1.160",
2134
+        "OomKillDisable": true,
2135
+        "OSType": "linux",
2136
+        "OomScoreAdj": 500,
2137
+        "OperatingSystem": "Boot2Docker",
2138
+        "RegistryConfig": {
2139
+            "IndexConfigs": {
2140
+                "docker.io": {
2141
+                    "Mirrors": null,
2142
+                    "Name": "docker.io",
2143
+                    "Official": true,
2144
+                    "Secure": true
2145
+                }
2146
+            },
2147
+            "InsecureRegistryCIDRs": [
2148
+                "127.0.0.0/8"
2149
+            ]
2150
+        },
2151
+        "SwapLimit": false,
2152
+        "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
2153
+        "ServerVersion": "1.9.0"
2154
+    }
2155
+
2156
+Status Codes:
2157
+
2158
+-   **200** – no error
2159
+-   **500** – server error
2160
+
2161
+### Show the docker version information
2162
+
2163
+`GET /version`
2164
+
2165
+Show the docker version information
2166
+
2167
+**Example request**:
2168
+
2169
+    GET /version HTTP/1.1
2170
+
2171
+**Example response**:
2172
+
2173
+    HTTP/1.1 200 OK
2174
+    Content-Type: application/json
2175
+
2176
+    {
2177
+         "Version": "1.10.0-dev",
2178
+         "Os": "linux",
2179
+         "KernelVersion": "3.19.0-23-generic",
2180
+         "GoVersion": "go1.4.2",
2181
+         "GitCommit": "e75da4b",
2182
+         "Arch": "amd64",
2183
+         "ApiVersion": "1.23",
2184
+         "BuildTime": "2015-12-01T07:09:13.444803460+00:00",
2185
+         "Experimental": true
2186
+    }
2187
+
2188
+Status Codes:
2189
+
2190
+-   **200** – no error
2191
+-   **500** – server error
2192
+
2193
+### Ping the docker server
2194
+
2195
+`GET /_ping`
2196
+
2197
+Ping the docker server
2198
+
2199
+**Example request**:
2200
+
2201
+    GET /_ping HTTP/1.1
2202
+
2203
+**Example response**:
2204
+
2205
+    HTTP/1.1 200 OK
2206
+    Content-Type: text/plain
2207
+
2208
+    OK
2209
+
2210
+Status Codes:
2211
+
2212
+-   **200** - no error
2213
+-   **500** - server error
2214
+
2215
+### Create a new image from a container's changes
2216
+
2217
+`POST /commit`
2218
+
2219
+Create a new image from a container's changes
2220
+
2221
+**Example request**:
2222
+
2223
+    POST /commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
2224
+    Content-Type: application/json
2225
+
2226
+    {
2227
+         "Hostname": "",
2228
+         "Domainname": "",
2229
+         "User": "",
2230
+         "AttachStdin": false,
2231
+         "AttachStdout": true,
2232
+         "AttachStderr": true,
2233
+         "Tty": false,
2234
+         "OpenStdin": false,
2235
+         "StdinOnce": false,
2236
+         "Env": null,
2237
+         "Cmd": [
2238
+                 "date"
2239
+         ],
2240
+         "Mounts": [
2241
+           {
2242
+             "Source": "/data",
2243
+             "Destination": "/data",
2244
+             "Mode": "ro,Z",
2245
+             "RW": false
2246
+           }
2247
+         ],
2248
+         "Labels": {
2249
+                 "key1": "value1",
2250
+                 "key2": "value2"
2251
+          },
2252
+         "WorkingDir": "",
2253
+         "NetworkDisabled": false,
2254
+         "ExposedPorts": {
2255
+                 "22/tcp": {}
2256
+         }
2257
+    }
2258
+
2259
+**Example response**:
2260
+
2261
+    HTTP/1.1 201 Created
2262
+    Content-Type: application/json
2263
+
2264
+    {"Id": "596069db4bf5"}
2265
+
2266
+Json Parameters:
2267
+
2268
+-  **config** - the container's configuration
2269
+
2270
+Query Parameters:
2271
+
2272
+-   **container** – source container
2273
+-   **repo** – repository
2274
+-   **tag** – tag
2275
+-   **comment** – commit message
2276
+-   **author** – author (e.g., "John Hannibal Smith
2277
+    <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
2278
+-   **pause** – 1/True/true or 0/False/false, whether to pause the container before committing
2279
+-   **changes** – Dockerfile instructions to apply while committing
2280
+
2281
+Status Codes:
2282
+
2283
+-   **201** – no error
2284
+-   **404** – no such container
2285
+-   **500** – server error
2286
+
2287
+### Monitor Docker's events
2288
+
2289
+`GET /events`
2290
+
2291
+Get container events from docker, either in real time via streaming, or via polling (using since).
2292
+
2293
+Docker containers report the following events:
2294
+
2295
+    attach, commit, copy, create, destroy, die, exec_create, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update
2296
+
2297
+Docker images report the following events:
2298
+
2299
+    delete, import, pull, push, tag, untag
2300
+
2301
+Docker volumes report the following events:
2302
+
2303
+    create, mount, unmount, destroy
2304
+
2305
+Docker networks report the following events:
2306
+
2307
+    create, connect, disconnect, destroy
2308
+
2309
+**Example request**:
2310
+
2311
+    GET /events?since=1374067924
2312
+
2313
+**Example response**:
2314
+
2315
+    HTTP/1.1 200 OK
2316
+    Content-Type: application/json
2317
+
2318
+    [
2319
+	    {
2320
+		"action": "pull",
2321
+		"type": "image", 
2322
+		"actor": {
2323
+			"id": "busybox:latest",
2324
+			"attributes": {}
2325
+		}
2326
+		"time": 1442421700,
2327
+		"timeNano": 1442421700598988358
2328
+	    },
2329
+            {
2330
+		"action": "create",
2331
+		"type": "container",
2332
+		"actor": {
2333
+			"id": "5745704abe9caa5",
2334
+			"attributes": {"image": "busybox"}
2335
+		}
2336
+		"time": 1442421716,
2337
+		"timeNano": 1442421716853979870
2338
+	    },
2339
+            {
2340
+		"action": "attach",
2341
+		"type": "container",
2342
+		"actor": {
2343
+			"id": "5745704abe9caa5",
2344
+			"attributes": {"image": "busybox"}
2345
+		}
2346
+		"time": 1442421716,
2347
+		"timeNano": 1442421716894759198
2348
+	    },
2349
+            {
2350
+		"action": "start",
2351
+		"type": "container",
2352
+		"actor": {
2353
+			"id": "5745704abe9caa5",
2354
+			"attributes": {"image": "busybox"}
2355
+		}
2356
+		"time": 1442421716,
2357
+		"timeNano": 1442421716983607193
2358
+	    }
2359
+    ]
2360
+
2361
+Query Parameters:
2362
+
2363
+-   **since** – Timestamp used for polling
2364
+-   **until** – Timestamp used for polling
2365
+-   **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
2366
+  -   `container=<string>`; -- container to filter
2367
+  -   `event=<string>`; -- event to filter
2368
+  -   `image=<string>`; -- image to filter
2369
+  -   `label=<string>`; -- image and container label to filter
2370
+  -   `type=<string>`; -- either `container` or `image` or `volume` or `network`
2371
+  -   `volume=<string>`; -- volume to filter
2372
+  -   `network=<string>`; -- network to filter
2373
+
2374
+Status Codes:
2375
+
2376
+-   **200** – no error
2377
+-   **500** – server error
2378
+
2379
+### Get a tarball containing all images in a repository
2380
+
2381
+`GET /images/(name)/get`
2382
+
2383
+Get a tarball containing all images and metadata for the repository specified
2384
+by `name`.
2385
+
2386
+If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
2387
+(and its parents) are returned. If `name` is an image ID, similarly only that
2388
+image (and its parents) are returned, but with the exclusion of the
2389
+'repositories' file in the tarball, as there were no image names referenced.
2390
+
2391
+See the [image tarball format](#image-tarball-format) for more details.
2392
+
2393
+**Example request**
2394
+
2395
+    GET /images/ubuntu/get
2396
+
2397
+**Example response**:
2398
+
2399
+    HTTP/1.1 200 OK
2400
+    Content-Type: application/x-tar
2401
+
2402
+    Binary data stream
2403
+
2404
+Status Codes:
2405
+
2406
+-   **200** – no error
2407
+-   **500** – server error
2408
+
2409
+### Get a tarball containing all images.
2410
+
2411
+`GET /images/get`
2412
+
2413
+Get a tarball containing all images and metadata for one or more repositories.
2414
+
2415
+For each value of the `names` parameter: if it is a specific name and tag (e.g.
2416
+`ubuntu:latest`), then only that image (and its parents) are returned; if it is
2417
+an image ID, similarly only that image (and its parents) are returned and there
2418
+would be no names referenced in the 'repositories' file for this image ID.
2419
+
2420
+See the [image tarball format](#image-tarball-format) for more details.
2421
+
2422
+**Example request**
2423
+
2424
+    GET /images/get?names=myname%2Fmyapp%3Alatest&names=busybox
2425
+
2426
+**Example response**:
2427
+
2428
+    HTTP/1.1 200 OK
2429
+    Content-Type: application/x-tar
2430
+
2431
+    Binary data stream
2432
+
2433
+Status Codes:
2434
+
2435
+-   **200** – no error
2436
+-   **500** – server error
2437
+
2438
+### Load a tarball with a set of images and tags into docker
2439
+
2440
+`POST /images/load`
2441
+
2442
+Load a set of images and tags into a Docker repository.
2443
+See the [image tarball format](#image-tarball-format) for more details.
2444
+
2445
+**Example request**
2446
+
2447
+    POST /images/load
2448
+
2449
+    Tarball in body
2450
+
2451
+**Example response**:
2452
+
2453
+    HTTP/1.1 200 OK
2454
+
2455
+Status Codes:
2456
+
2457
+-   **200** – no error
2458
+-   **500** – server error
2459
+
2460
+### Image tarball format
2461
+
2462
+An image tarball contains one directory per image layer (named using its long ID),
2463
+each containing these files:
2464
+
2465
+- `VERSION`: currently `1.0` - the file format version
2466
+- `json`: detailed layer information, similar to `docker inspect layer_id`
2467
+- `layer.tar`: A tarfile containing the filesystem changes in this layer
2468
+
2469
+The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
2470
+for storing attribute changes and deletions.
2471
+
2472
+If the tarball defines a repository, the tarball should also include a `repositories` file at
2473
+the root that contains a list of repository and tag names mapped to layer IDs.
2474
+
2475
+```
2476
+{"hello-world":
2477
+    {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
2478
+}
2479
+```
2480
+
2481
+### Exec Create
2482
+
2483
+`POST /containers/(id)/exec`
2484
+
2485
+Sets up an exec instance in a running container `id`
2486
+
2487
+**Example request**:
2488
+
2489
+    POST /containers/e90e34656806/exec HTTP/1.1
2490
+    Content-Type: application/json
2491
+
2492
+      {
2493
+       "AttachStdin": false,
2494
+       "AttachStdout": true,
2495
+       "AttachStderr": true,
2496
+       "DetachKeys": "ctrl-p,ctrl-q",
2497
+       "Tty": false,
2498
+       "Cmd": [
2499
+                     "date"
2500
+             ]
2501
+      }
2502
+
2503
+**Example response**:
2504
+
2505
+    HTTP/1.1 201 OK
2506
+    Content-Type: application/json
2507
+
2508
+    {
2509
+         "Id": "f90e34656806",
2510
+         "Warnings":[]
2511
+    }
2512
+
2513
+Json Parameters:
2514
+
2515
+-   **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
2516
+-   **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
2517
+-   **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
2518
+-   **DetachKeys** – Override the key sequence for detaching a
2519
+        container. Format is a single character `[a-Z]` or `ctrl-<value>`
2520
+        where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
2521
+-   **Tty** - Boolean value to allocate a pseudo-TTY.
2522
+-   **Cmd** - Command to run specified as a string or an array of strings.
2523
+
2524
+
2525
+Status Codes:
2526
+
2527
+-   **201** – no error
2528
+-   **404** – no such container
2529
+-   **409** - container is paused
2530
+-   **500** - server error
2531
+
2532
+### Exec Start
2533
+
2534
+`POST /exec/(id)/start`
2535
+
2536
+Starts a previously set up `exec` instance `id`. If `detach` is true, this API
2537
+returns after starting the `exec` command. Otherwise, this API sets up an
2538
+interactive session with the `exec` command.
2539
+
2540
+**Example request**:
2541
+
2542
+    POST /exec/e90e34656806/start HTTP/1.1
2543
+    Content-Type: application/json
2544
+
2545
+    {
2546
+     "Detach": false,
2547
+     "Tty": false
2548
+    }
2549
+
2550
+**Example response**:
2551
+
2552
+    HTTP/1.1 201 OK
2553
+    Content-Type: application/json
2554
+
2555
+    {{ STREAM }}
2556
+
2557
+Json Parameters:
2558
+
2559
+-   **Detach** - Detach from the `exec` command.
2560
+-   **Tty** - Boolean value to allocate a pseudo-TTY.
2561
+
2562
+Status Codes:
2563
+
2564
+-   **200** – no error
2565
+-   **404** – no such exec instance
2566
+-   **409** - container is paused
2567
+
2568
+    **Stream details**:
2569
+    Similar to the stream behavior of `POST /container/(id)/attach` API
2570
+
2571
+### Exec Resize
2572
+
2573
+`POST /exec/(id)/resize`
2574
+
2575
+Resizes the `tty` session used by the `exec` command `id`.  The unit is number of characters.
2576
+This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
2577
+
2578
+**Example request**:
2579
+
2580
+    POST /exec/e90e34656806/resize?h=40&w=80 HTTP/1.1
2581
+    Content-Type: text/plain
2582
+
2583
+**Example response**:
2584
+
2585
+    HTTP/1.1 201 OK
2586
+    Content-Type: text/plain
2587
+
2588
+Query Parameters:
2589
+
2590
+-   **h** – height of `tty` session
2591
+-   **w** – width
2592
+
2593
+Status Codes:
2594
+
2595
+-   **201** – no error
2596
+-   **404** – no such exec instance
2597
+
2598
+### Exec Inspect
2599
+
2600
+`GET /exec/(id)/json`
2601
+
2602
+Return low-level information about the `exec` command `id`.
2603
+
2604
+**Example request**:
2605
+
2606
+    GET /exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
2607
+
2608
+**Example response**:
2609
+
2610
+    HTTP/1.1 200 OK
2611
+    Content-Type: plain/text
2612
+
2613
+    {
2614
+      "ID" : "11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39",
2615
+      "Running" : false,
2616
+      "ExitCode" : 2,
2617
+      "ProcessConfig" : {
2618
+        "privileged" : false,
2619
+        "user" : "",
2620
+        "tty" : false,
2621
+        "entrypoint" : "sh",
2622
+        "arguments" : [
2623
+          "-c",
2624
+          "exit 2"
2625
+        ]
2626
+      },
2627
+      "OpenStdin" : false,
2628
+      "OpenStderr" : false,
2629
+      "OpenStdout" : false,
2630
+      "Container" : {
2631
+        "State" : {
2632
+          "Status" : "running",
2633
+          "Running" : true,
2634
+          "Paused" : false,
2635
+          "Restarting" : false,
2636
+          "OOMKilled" : false,
2637
+          "Pid" : 3650,
2638
+          "ExitCode" : 0,
2639
+          "Error" : "",
2640
+          "StartedAt" : "2014-11-17T22:26:03.717657531Z",
2641
+          "FinishedAt" : "0001-01-01T00:00:00Z"
2642
+        },
2643
+        "ID" : "8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c",
2644
+        "Created" : "2014-11-17T22:26:03.626304998Z",
2645
+        "Path" : "date",
2646
+        "Args" : [],
2647
+        "Config" : {
2648
+          "Hostname" : "8f177a186b97",
2649
+          "Domainname" : "",
2650
+          "User" : "",
2651
+          "AttachStdin" : false,
2652
+          "AttachStdout" : false,
2653
+          "AttachStderr" : false,
2654
+          "ExposedPorts" : null,
2655
+          "Tty" : false,
2656
+          "OpenStdin" : false,
2657
+          "StdinOnce" : false,
2658
+          "Env" : [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ],
2659
+          "Cmd" : [
2660
+            "date"
2661
+          ],
2662
+          "Image" : "ubuntu",
2663
+          "Volumes" : null,
2664
+          "WorkingDir" : "",
2665
+          "Entrypoint" : null,
2666
+          "NetworkDisabled" : false,
2667
+          "MacAddress" : "",
2668
+          "OnBuild" : null,
2669
+          "SecurityOpt" : null
2670
+        },
2671
+        "Image" : "5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5",
2672
+        "NetworkSettings": {
2673
+            "Bridge": "",
2674
+            "SandboxID": "",
2675
+            "HairpinMode": false,
2676
+            "LinkLocalIPv6Address": "",
2677
+            "LinkLocalIPv6PrefixLen": 0,
2678
+            "Ports": null,
2679
+            "SandboxKey": "",
2680
+            "SecondaryIPAddresses": null,
2681
+            "SecondaryIPv6Addresses": null,
2682
+            "EndpointID": "",
2683
+            "Gateway": "",
2684
+            "GlobalIPv6Address": "",
2685
+            "GlobalIPv6PrefixLen": 0,
2686
+            "IPAddress": "",
2687
+            "IPPrefixLen": 0,
2688
+            "IPv6Gateway": "",
2689
+            "MacAddress": "",
2690
+            "Networks": {
2691
+                "bridge": {
2692
+                    "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
2693
+                    "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
2694
+                    "Gateway": "172.17.0.1",
2695
+                    "IPAddress": "172.17.0.2",
2696
+                    "IPPrefixLen": 16,
2697
+                    "IPv6Gateway": "",
2698
+                    "GlobalIPv6Address": "",
2699
+                    "GlobalIPv6PrefixLen": 0,
2700
+                    "MacAddress": "02:42:ac:12:00:02"
2701
+                }
2702
+            }
2703
+        },
2704
+        "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf",
2705
+        "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname",
2706
+        "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts",
2707
+        "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
2708
+        "Name" : "/test",
2709
+        "Driver" : "aufs",
2710
+        "ExecDriver" : "native-0.2",
2711
+        "MountLabel" : "",
2712
+        "ProcessLabel" : "",
2713
+        "AppArmorProfile" : "",
2714
+        "RestartCount" : 0,
2715
+        "Mounts" : []
2716
+      }
2717
+    }
2718
+
2719
+Status Codes:
2720
+
2721
+-   **200** – no error
2722
+-   **404** – no such exec instance
2723
+-   **500** - server error
2724
+
2725
+## 2.4 Volumes
2726
+
2727
+### List volumes
2728
+
2729
+`GET /volumes`
2730
+
2731
+**Example request**:
2732
+
2733
+    GET /volumes HTTP/1.1
2734
+
2735
+**Example response**:
2736
+
2737
+    HTTP/1.1 200 OK
2738
+    Content-Type: application/json
2739
+
2740
+    {
2741
+      "Volumes": [
2742
+        {
2743
+          "Name": "tardis",
2744
+          "Driver": "local",
2745
+          "Mountpoint": "/var/lib/docker/volumes/tardis"
2746
+        }
2747
+      ]
2748
+    }
2749
+
2750
+Query Parameters:
2751
+
2752
+- **filters** - JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. There is one available filter: `dangling=true`
2753
+
2754
+Status Codes:
2755
+
2756
+-   **200** - no error
2757
+-   **500** - server error
2758
+
2759
+### Create a volume
2760
+
2761
+`POST /volumes/create`
2762
+
2763
+Create a volume
2764
+
2765
+**Example request**:
2766
+
2767
+    POST /volumes/create HTTP/1.1
2768
+    Content-Type: application/json
2769
+
2770
+    {
2771
+      "Name": "tardis"
2772
+    }
2773
+
2774
+**Example response**:
2775
+
2776
+    HTTP/1.1 201 Created
2777
+    Content-Type: application/json
2778
+
2779
+    {
2780
+      "Name": "tardis",
2781
+      "Driver": "local",
2782
+      "Mountpoint": "/var/lib/docker/volumes/tardis"
2783
+    }
2784
+
2785
+Status Codes:
2786
+
2787
+- **201** - no error
2788
+- **500**  - server error
2789
+
2790
+JSON Parameters:
2791
+
2792
+- **Name** - The new volume's name. If not specified, Docker generates a name.
2793
+- **Driver** - Name of the volume driver to use. Defaults to `local` for the name.
2794
+- **DriverOpts** - A mapping of driver options and values. These options are
2795
+    passed directly to the driver and are driver specific.
2796
+
2797
+### Inspect a volume
2798
+
2799
+`GET /volumes/(name)`
2800
+
2801
+Return low-level information on the volume `name`
2802
+
2803
+**Example request**:
2804
+
2805
+    GET /volumes/tardis
2806
+
2807
+**Example response**:
2808
+
2809
+    HTTP/1.1 200 OK
2810
+    Content-Type: application/json
2811
+
2812
+    {
2813
+      "Name": "tardis",
2814
+      "Driver": "local",
2815
+      "Mountpoint": "/var/lib/docker/volumes/tardis"
2816
+    }
2817
+
2818
+Status Codes:
2819
+
2820
+-   **200** - no error
2821
+-   **404** - no such volume
2822
+-   **500** - server error
2823
+
2824
+### Remove a volume
2825
+
2826
+`DELETE /volumes/(name)`
2827
+
2828
+Instruct the driver to remove the volume (`name`).
2829
+
2830
+**Example request**:
2831
+
2832
+    DELETE /volumes/tardis HTTP/1.1
2833
+
2834
+**Example response**:
2835
+
2836
+    HTTP/1.1 204 No Content
2837
+
2838
+Status Codes
2839
+
2840
+-   **204** - no error
2841
+-   **404** - no such volume or volume driver
2842
+-   **409** - volume is in use and cannot be removed
2843
+-   **500** - server error
2844
+
2845
+## 2.5 Networks
2846
+
2847
+### List networks
2848
+
2849
+`GET /networks`
2850
+
2851
+**Example request**:
2852
+
2853
+    GET /networks?filters={"type":{"custom":true}} HTTP/1.1
2854
+
2855
+**Example response**:
2856
+
2857
+```
2858
+HTTP/1.1 200 OK
2859
+Content-Type: application/json
2860
+
2861
+[
2862
+  {
2863
+    "Name": "bridge",
2864
+    "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566",
2865
+    "Scope": "local",
2866
+    "Driver": "bridge",
2867
+    "IPAM": {
2868
+      "Driver": "default",
2869
+      "Config": [
2870
+        {
2871
+          "Subnet": "172.17.0.0/16"
2872
+        }
2873
+      ]
2874
+    },
2875
+    "Containers": {
2876
+      "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": {
2877
+        "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda",
2878
+        "MacAddress": "02:42:ac:11:00:02",
2879
+        "IPv4Address": "172.17.0.2/16",
2880
+        "IPv6Address": ""
2881
+      }
2882
+    },
2883
+    "Options": {
2884
+      "com.docker.network.bridge.default_bridge": "true",
2885
+      "com.docker.network.bridge.enable_icc": "true",
2886
+      "com.docker.network.bridge.enable_ip_masquerade": "true",
2887
+      "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
2888
+      "com.docker.network.bridge.name": "docker0",
2889
+      "com.docker.network.driver.mtu": "1500"
2890
+    }
2891
+  },
2892
+  {
2893
+    "Name": "none",
2894
+    "Id": "e086a3893b05ab69242d3c44e49483a3bbbd3a26b46baa8f61ab797c1088d794",
2895
+    "Scope": "local",
2896
+    "Driver": "null",
2897
+    "IPAM": {
2898
+      "Driver": "default",
2899
+      "Config": []
2900
+    },
2901
+    "Containers": {},
2902
+    "Options": {}
2903
+  },
2904
+  {
2905
+    "Name": "host",
2906
+    "Id": "13e871235c677f196c4e1ecebb9dc733b9b2d2ab589e30c539efeda84a24215e",
2907
+    "Scope": "local",
2908
+    "Driver": "host",
2909
+    "IPAM": {
2910
+      "Driver": "default",
2911
+      "Config": []
2912
+    },
2913
+    "Containers": {},
2914
+    "Options": {}
2915
+  }
2916
+]
2917
+```
2918
+
2919
+Query Parameters:
2920
+
2921
+- **filters** - JSON encoded network list filter. The filter value is one of: 
2922
+  -   `name=<network-name>` Matches all or part of a network name.
2923
+  -   `id=<network-id>` Matches all or part of a network id.
2924
+  -   `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword returns all user-defined networks.
2925
+
2926
+Status Codes:
2927
+
2928
+-   **200** - no error
2929
+-   **500** - server error
2930
+
2931
+### Inspect network
2932
+
2933
+`GET /networks/<network-id>`
2934
+
2935
+**Example request**:
2936
+
2937
+    GET /networks/7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 HTTP/1.1
2938
+
2939
+**Example response**:
2940
+
2941
+```
2942
+HTTP/1.1 200 OK
2943
+Content-Type: application/json
2944
+
2945
+{
2946
+  "Name": "net01",
2947
+  "Id": "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99",
2948
+  "Scope": "local",
2949
+  "Driver": "bridge",
2950
+  "IPAM": {
2951
+    "Driver": "default",
2952
+    "Config": [
2953
+      {
2954
+        "Subnet": "172.19.0.0/16",
2955
+        "Gateway": "172.19.0.1/16"
2956
+      }
2957
+    ],
2958
+    "Options": {
2959
+        "foo": "bar"
2960
+    }
2961
+  },
2962
+  "Containers": {
2963
+    "19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c": {
2964
+      "Name": "test",
2965
+      "EndpointID": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a",
2966
+      "MacAddress": "02:42:ac:13:00:02",
2967
+      "IPv4Address": "172.19.0.2/16",
2968
+      "IPv6Address": ""
2969
+    }
2970
+  },
2971
+  "Options": {
2972
+    "com.docker.network.bridge.default_bridge": "true",
2973
+    "com.docker.network.bridge.enable_icc": "true",
2974
+    "com.docker.network.bridge.enable_ip_masquerade": "true",
2975
+    "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
2976
+    "com.docker.network.bridge.name": "docker0",
2977
+    "com.docker.network.driver.mtu": "1500"
2978
+  }
2979
+}
2980
+```
2981
+
2982
+Status Codes:
2983
+
2984
+-   **200** - no error
2985
+-   **404** - network not found
2986
+
2987
+### Create a network
2988
+
2989
+`POST /networks/create`
2990
+
2991
+Create a network
2992
+
2993
+**Example request**:
2994
+
2995
+```
2996
+POST /networks/create HTTP/1.1
2997
+Content-Type: application/json
2998
+
2999
+{
3000
+  "Name":"isolated_nw",
3001
+  "Driver":"bridge",
3002
+  "IPAM":{
3003
+    "Config":[{
3004
+      "Subnet":"172.20.0.0/16",
3005
+      "IPRange":"172.20.10.0/24",
3006
+      "Gateway":"172.20.10.11"
3007
+    }],
3008
+    "Options": {
3009
+        "foo": "bar"
3010
+    }
3011
+  },
3012
+  "Internal":true
3013
+}
3014
+```
3015
+
3016
+**Example response**:
3017
+
3018
+```
3019
+HTTP/1.1 201 Created
3020
+Content-Type: application/json
3021
+
3022
+{
3023
+  "Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30",
3024
+  "Warning": ""
3025
+}
3026
+```
3027
+
3028
+Status Codes:
3029
+
3030
+- **201** - no error
3031
+- **404** - plugin not found
3032
+- **500** - server error
3033
+
3034
+JSON Parameters:
3035
+
3036
+- **Name** - The new network's name. this is a mandatory field
3037
+- **Driver** - Name of the network driver plugin to use. Defaults to `bridge` driver
3038
+- **IPAM** - Optional custom IP scheme for the network
3039
+- **Options** - Network specific options to be used by the drivers
3040
+- **CheckDuplicate** - Requests daemon to check for networks with same name
3041
+
3042
+### Connect a container to a network
3043
+
3044
+`POST /networks/(id)/connect`
3045
+
3046
+Connects a container to a network
3047
+
3048
+**Example request**:
3049
+
3050
+```
3051
+POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/connect HTTP/1.1
3052
+Content-Type: application/json
3053
+
3054
+{
3055
+  "Container":"3613f73ba0e4",
3056
+  "EndpointConfig": {
3057
+    "test_nw": {
3058
+        "IPv4Address":"172.24.56.89",
3059
+        "IPv6Address":"2001:db8::5689"
3060
+    }
3061
+  }
3062
+}
3063
+```
3064
+
3065
+**Example response**:
3066
+
3067
+    HTTP/1.1 200 OK
3068
+
3069
+Status Codes:
3070
+
3071
+- **200** - no error
3072
+- **404** - network or container is not found
3073
+- **500** - Internal Server Error
3074
+
3075
+JSON Parameters:
3076
+
3077
+- **container** - container-id/name to be connected to the network
3078
+
3079
+### Disconnect a container from a network
3080
+
3081
+`POST /networks/(id)/disconnect`
3082
+
3083
+Disconnects a container from a network
3084
+
3085
+**Example request**:
3086
+
3087
+```
3088
+POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/disconnect HTTP/1.1
3089
+Content-Type: application/json
3090
+
3091
+{
3092
+  "Container":"3613f73ba0e4",
3093
+  "Force":false
3094
+}
3095
+```
3096
+
3097
+**Example response**:
3098
+
3099
+    HTTP/1.1 200 OK
3100
+
3101
+Status Codes:
3102
+
3103
+- **200** - no error
3104
+- **404** - network or container not found
3105
+- **500** - Internal Server Error
3106
+
3107
+JSON Parameters:
3108
+
3109
+- **Container** - container-id/name to be disconnected from a network
3110
+- **Force** - Force the container to disconnect from a network
3111
+
3112
+### Remove a network
3113
+
3114
+`DELETE /networks/(id)`
3115
+
3116
+Instruct the driver to remove the network (`id`).
3117
+
3118
+**Example request**:
3119
+
3120
+    DELETE /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30 HTTP/1.1
3121
+
3122
+**Example response**:
3123
+
3124
+    HTTP/1.1 200 OK
3125
+
3126
+Status Codes
3127
+
3128
+-   **200** - no error
3129
+-   **404** - no such network
3130
+-   **500** - server error
3131
+
3132
+# 3. Going further
3133
+
3134
+## 3.1 Inside `docker run`
3135
+
3136
+As an example, the `docker run` command line makes the following API calls:
3137
+
3138
+- Create the container
3139
+
3140
+- If the status code is 404, it means the image doesn't exist:
3141
+    - Try to pull it.
3142
+    - Then, retry to create the container.
3143
+
3144
+- Start the container.
3145
+
3146
+- If you are not in detached mode:
3147
+- Attach to the container, using `logs=1` (to have `stdout` and
3148
+      `stderr` from the container's start) and `stream=1`
3149
+
3150
+- If in detached mode or only `stdin` is attached, display the container's id.
3151
+
3152
+## 3.2 Hijacking
3153
+
3154
+In this version of the API, `/attach`, uses hijacking to transport `stdin`,
3155
+`stdout`, and `stderr` on the same socket.
3156
+
3157
+To hint potential proxies about connection hijacking, Docker client sends
3158
+connection upgrade headers similarly to websocket.
3159
+
3160
+    Upgrade: tcp
3161
+    Connection: Upgrade
3162
+
3163
+When Docker daemon detects the `Upgrade` header, it switches its status code
3164
+from **200 OK** to **101 UPGRADED** and resends the same headers.
3165
+
3166
+
3167
+## 3.3 CORS Requests
3168
+
3169
+To set cross origin requests to the remote api please give values to
3170
+`--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
3171
+default or blank means CORS disabled
3172
+
3173
+    $ docker daemon -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"