Browse code

Merge pull request #22148 from thaJeztah/remove-old-api-versions

Remove API versions 1.17 and older from documentation

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