Browse code

Bump docs and api to 1.15

Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>

Alexandr Morozov authored on 2014/08/26 18:08:50
Showing 4 changed files
... ...
@@ -12,7 +12,7 @@ import (
12 12
 )
13 13
 
14 14
 const (
15
-	APIVERSION        version.Version = "1.14"
15
+	APIVERSION        version.Version = "1.15"
16 16
 	DEFAULTHTTPHOST                   = "127.0.0.1"
17 17
 	DEFAULTUNIXSOCKET                 = "/var/run/docker.sock"
18 18
 )
... ...
@@ -106,6 +106,7 @@ pages:
106 106
 - ['reference/api/registry_api.md', 'Reference', 'Docker Registry API']
107 107
 - ['reference/api/hub_registry_spec.md', 'Reference', 'Docker Hub and Registry Spec']
108 108
 - ['reference/api/docker_remote_api.md', 'Reference', 'Docker Remote API']
109
+- ['reference/api/docker_remote_api_v1.15.md', 'Reference', 'Docker Remote API v1.15']
109 110
 - ['reference/api/docker_remote_api_v1.14.md', 'Reference', 'Docker Remote API v1.14']
110 111
 - ['reference/api/docker_remote_api_v1.13.md', 'Reference', 'Docker Remote API v1.13']
111 112
 - ['reference/api/docker_remote_api_v1.12.md', 'Reference', 'Docker Remote API v1.12']
... ...
@@ -18,13 +18,21 @@ page_keywords: API, Docker, rcli, REST, documentation
18 18
    encoded (JSON) string with credentials:
19 19
    `{'username': string, 'password': string, 'email': string, 'serveraddress' : string}`
20 20
 
21
-The current version of the API is v1.14
21
+The current version of the API is v1.15
22 22
 
23 23
 Calling `/info` is the same as calling
24
-`/v1.14/info`.
24
+`/v1.15/info`.
25 25
 
26 26
 You can still call an old version of the API using
27
-`/v1.13/info`.
27
+`/v1.14/info`.
28
+
29
+## v1.15
30
+
31
+### Full Documentation
32
+
33
+[*Docker Remote API v1.15*](/reference/api/docker_remote_api_v1.15/)
34
+
35
+### What's new
28 36
 
29 37
 ## v1.14
30 38
 
31 39
new file mode 100644
... ...
@@ -0,0 +1,1411 @@
0
+page_title: Remote API v1.15
1
+page_description: API Documentation for Docker
2
+page_keywords: API, Docker, rcli, REST, documentation
3
+
4
+# Docker Remote API v1.15
5
+
6
+## 1. Brief introduction
7
+
8
+ - The Remote API has replaced `rcli`.
9
+ - The daemon listens on `unix:///var/run/docker.sock` but you can
10
+   [*Bind Docker to another host/port or a Unix socket*](
11
+   /use/basics/#bind-docker).
12
+ - The API tends to be REST, but for some complex commands, like `attach`
13
+   or `pull`, the HTTP connection is hijacked to transport `STDOUT`,
14
+   `STDIN` and `STDERR`.
15
+
16
+# 2. Endpoints
17
+
18
+## 2.1 Containers
19
+
20
+### List containers
21
+
22
+`GET /containers/json`
23
+
24
+List containers
25
+
26
+    **Example request**:
27
+
28
+        GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
29
+
30
+    **Example response**:
31
+
32
+        HTTP/1.1 200 OK
33
+        Content-Type: application/json
34
+
35
+        [
36
+             {
37
+                     "Id": "8dfafdbc3a40",
38
+                     "Image": "base:latest",
39
+                     "Command": "echo 1",
40
+                     "Created": 1367854155,
41
+                     "Status": "Exit 0",
42
+                     "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
43
+                     "SizeRw":12288,
44
+                     "SizeRootFs":0
45
+             },
46
+             {
47
+                     "Id": "9cd87474be90",
48
+                     "Image": "base:latest",
49
+                     "Command": "echo 222222",
50
+                     "Created": 1367854155,
51
+                     "Status": "Exit 0",
52
+                     "Ports":[],
53
+                     "SizeRw":12288,
54
+                     "SizeRootFs":0
55
+             },
56
+             {
57
+                     "Id": "3176a2479c92",
58
+                     "Image": "base:latest",
59
+                     "Command": "echo 3333333333333333",
60
+                     "Created": 1367854154,
61
+                     "Status": "Exit 0",
62
+                     "Ports":[],
63
+                     "SizeRw":12288,
64
+                     "SizeRootFs":0
65
+             },
66
+             {
67
+                     "Id": "4cb07b47f9fb",
68
+                     "Image": "base:latest",
69
+                     "Command": "echo 444444444444444444444444444444444",
70
+                     "Created": 1367854152,
71
+                     "Status": "Exit 0",
72
+                     "Ports":[],
73
+                     "SizeRw":12288,
74
+                     "SizeRootFs":0
75
+             }
76
+        ]
77
+
78
+    Query Parameters:
79
+
80
+     
81
+
82
+    -   **all** – 1/True/true or 0/False/false, Show all containers.
83
+        Only running containers are shown by default
84
+    -   **limit** – Show `limit` last created
85
+        containers, include non-running ones.
86
+    -   **since** – Show only containers created since Id, include
87
+        non-running ones.
88
+    -   **before** – Show only containers created before Id, include
89
+        non-running ones.
90
+    -   **size** – 1/True/true or 0/False/false, Show the containers
91
+        sizes
92
+
93
+    Status Codes:
94
+
95
+    -   **200** – no error
96
+    -   **400** – bad parameter
97
+    -   **500** – server error
98
+
99
+### Create a container
100
+
101
+`POST /containers/create`
102
+
103
+Create a container
104
+
105
+    **Example request**:
106
+
107
+        POST /containers/create HTTP/1.1
108
+        Content-Type: application/json
109
+
110
+        {
111
+             "Hostname":"",
112
+             "User":"",
113
+             "Memory":0,
114
+             "MemorySwap":0,
115
+             "AttachStdin":false,
116
+             "AttachStdout":true,
117
+             "AttachStderr":true,
118
+             "PortSpecs":null,
119
+             "Tty":false,
120
+             "OpenStdin":false,
121
+             "StdinOnce":false,
122
+             "Env":null,
123
+             "Cmd":[
124
+                     "date"
125
+             ],
126
+             "Image":"base",
127
+             "Volumes":{
128
+                     "/tmp": {}
129
+             },
130
+             "WorkingDir":"",
131
+             "DisableNetwork": false,
132
+             "ExposedPorts":{
133
+                     "22/tcp": {}
134
+             }
135
+        }
136
+
137
+    **Example response**:
138
+
139
+        HTTP/1.1 201 OK
140
+        Content-Type: application/json
141
+
142
+        {
143
+             "Id":"e90e34656806"
144
+             "Warnings":[]
145
+        }
146
+
147
+    Json Parameters:
148
+
149
+     
150
+
151
+    -   **config** – the container's configuration
152
+
153
+    Query Parameters:
154
+
155
+     
156
+
157
+    -   **name** – Assign the specified name to the container. Must
158
+        match `/?[a-zA-Z0-9_-]+`.
159
+
160
+    Status Codes:
161
+
162
+    -   **201** – no error
163
+    -   **404** – no such container
164
+    -   **406** – impossible to attach (container not running)
165
+    -   **500** – server error
166
+
167
+### Inspect a container
168
+
169
+`GET /containers/(id)/json`
170
+
171
+Return low-level information on the container `id`
172
+
173
+
174
+    **Example request**:
175
+
176
+        GET /containers/4fa6e0f0c678/json HTTP/1.1
177
+
178
+    **Example response**:
179
+
180
+        HTTP/1.1 200 OK
181
+        Content-Type: application/json
182
+
183
+        {
184
+                     "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2",
185
+                     "Created": "2013-05-07T14:51:42.041847+02:00",
186
+                     "Path": "date",
187
+                     "Args": [],
188
+                     "Config": {
189
+                             "Hostname": "4fa6e0f0c678",
190
+                             "User": "",
191
+                             "Memory": 0,
192
+                             "MemorySwap": 0,
193
+                             "AttachStdin": false,
194
+                             "AttachStdout": true,
195
+                             "AttachStderr": true,
196
+                             "PortSpecs": null,
197
+                             "Tty": false,
198
+                             "OpenStdin": false,
199
+                             "StdinOnce": false,
200
+                             "Env": null,
201
+                             "Cmd": [
202
+                                     "date"
203
+                             ],
204
+                             "Dns": null,
205
+                             "Image": "base",
206
+                             "Volumes": {},
207
+                             "VolumesFrom": "",
208
+                             "WorkingDir":""
209
+
210
+                     },
211
+                     "State": {
212
+                             "Running": false,
213
+                             "Pid": 0,
214
+                             "ExitCode": 0,
215
+                             "StartedAt": "2013-05-07T14:51:42.087658+02:01360",
216
+                             "Ghost": false
217
+                     },
218
+                     "Image": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
219
+                     "NetworkSettings": {
220
+                             "IpAddress": "",
221
+                             "IpPrefixLen": 0,
222
+                             "Gateway": "",
223
+                             "Bridge": "",
224
+                             "PortMapping": null
225
+                     },
226
+                     "SysInitPath": "/home/kitty/go/src/github.com/docker/docker/bin/docker",
227
+                     "ResolvConfPath": "/etc/resolv.conf",
228
+                     "Volumes": {},
229
+                     "HostConfig": {
230
+                         "Binds": null,
231
+                         "ContainerIDFile": "",
232
+                         "LxcConf": [],
233
+                         "Privileged": false,
234
+                         "PortBindings": {
235
+                            "80/tcp": [
236
+                                {
237
+                                    "HostIp": "0.0.0.0",
238
+                                    "HostPort": "49153"
239
+                                }
240
+                            ]
241
+                         },
242
+                         "Links": ["/name:alias"],
243
+                         "PublishAllPorts": false,
244
+                         "CapAdd: ["NET_ADMIN"],
245
+                         "CapDrop: ["MKNOD"]
246
+                     }
247
+        }
248
+
249
+    Status Codes:
250
+
251
+    -   **200** – no error
252
+    -   **404** – no such container
253
+    -   **500** – server error
254
+
255
+### List processes running inside a container
256
+
257
+`GET /containers/(id)/top`
258
+
259
+List processes running inside the container `id`
260
+
261
+    **Example request**:
262
+
263
+        GET /containers/4fa6e0f0c678/top HTTP/1.1
264
+
265
+    **Example response**:
266
+
267
+        HTTP/1.1 200 OK
268
+        Content-Type: application/json
269
+
270
+        {
271
+             "Titles":[
272
+                     "USER",
273
+                     "PID",
274
+                     "%CPU",
275
+                     "%MEM",
276
+                     "VSZ",
277
+                     "RSS",
278
+                     "TTY",
279
+                     "STAT",
280
+                     "START",
281
+                     "TIME",
282
+                     "COMMAND"
283
+                     ],
284
+             "Processes":[
285
+                     ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
286
+                     ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
287
+             ]
288
+        }
289
+
290
+    Query Parameters:
291
+
292
+     
293
+
294
+    -   **ps_args** – ps arguments to use (e.g., aux)
295
+
296
+    Status Codes:
297
+
298
+    -   **200** – no error
299
+    -   **404** – no such container
300
+    -   **500** – server error
301
+
302
+### Get container logs
303
+
304
+`GET /containers/(id)/logs`
305
+
306
+Get stdout and stderr logs from the container ``id``
307
+
308
+    **Example request**:
309
+
310
+       GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1&timestamps=1&follow=1&tail=10 HTTP/1.1
311
+
312
+    **Example response**:
313
+
314
+       HTTP/1.1 200 OK
315
+       Content-Type: application/vnd.docker.raw-stream
316
+
317
+       {{ STREAM }}
318
+
319
+    Query Parameters:
320
+
321
+     
322
+
323
+    -   **follow** – 1/True/true or 0/False/false, return stream. Default false
324
+    -   **stdout** – 1/True/true or 0/False/false, show stdout log. Default false
325
+    -   **stderr** – 1/True/true or 0/False/false, show stderr log. Default false
326
+    -   **timestamps** – 1/True/true or 0/False/false, print timestamps for
327
+        every log line. Default false
328
+    -   **tail** – Output specified number of lines at the end of logs: `all` or `<number>`. Default all
329
+
330
+    Status Codes:
331
+
332
+    -   **200** – no error
333
+    -   **404** – no such container
334
+    -   **500** – server error
335
+
336
+### Inspect changes on a container's filesystem
337
+
338
+`GET /containers/(id)/changes`
339
+
340
+Inspect changes on container `id`'s filesystem
341
+
342
+    **Example request**:
343
+
344
+        GET /containers/4fa6e0f0c678/changes HTTP/1.1
345
+
346
+    **Example response**:
347
+
348
+        HTTP/1.1 200 OK
349
+        Content-Type: application/json
350
+
351
+        [
352
+             {
353
+                     "Path":"/dev",
354
+                     "Kind":0
355
+             },
356
+             {
357
+                     "Path":"/dev/kmsg",
358
+                     "Kind":1
359
+             },
360
+             {
361
+                     "Path":"/test",
362
+                     "Kind":1
363
+             }
364
+        ]
365
+
366
+    Status Codes:
367
+
368
+    -   **200** – no error
369
+    -   **404** – no such container
370
+    -   **500** – server error
371
+
372
+### Export a container
373
+
374
+`GET /containers/(id)/export`
375
+
376
+Export the contents of container `id`
377
+
378
+    **Example request**:
379
+
380
+        GET /containers/4fa6e0f0c678/export HTTP/1.1
381
+
382
+    **Example response**:
383
+
384
+        HTTP/1.1 200 OK
385
+        Content-Type: application/octet-stream
386
+
387
+        {{ STREAM }}
388
+
389
+    Status Codes:
390
+
391
+    -   **200** – no error
392
+    -   **404** – no such container
393
+    -   **500** – server error
394
+
395
+### Start a container
396
+
397
+`POST /containers/(id)/start`
398
+
399
+Start the container `id`
400
+
401
+    **Example request**:
402
+
403
+        POST /containers/(id)/start HTTP/1.1
404
+        Content-Type: application/json
405
+
406
+        {
407
+             "Binds":["/tmp:/tmp"],
408
+             "Links":["redis3:redis"],
409
+             "LxcConf":{"lxc.utsname":"docker"},
410
+             "PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
411
+             "PublishAllPorts":false,
412
+             "Privileged":false,
413
+             "Dns": ["8.8.8.8"],
414
+             "VolumesFrom": ["parent", "other:ro"],
415
+             "CapAdd: ["NET_ADMIN"],
416
+             "CapDrop: ["MKNOD"]
417
+        }
418
+
419
+    **Example response**:
420
+
421
+        HTTP/1.1 204 No Content
422
+        Content-Type: text/plain
423
+
424
+    Json Parameters:
425
+
426
+     
427
+
428
+    -   **hostConfig** – the container's host configuration (optional)
429
+
430
+    Status Codes:
431
+
432
+    -   **204** – no error
433
+    -   **304** – container already started
434
+    -   **404** – no such container
435
+    -   **500** – server error
436
+
437
+### Stop a container
438
+
439
+`POST /containers/(id)/stop`
440
+
441
+Stop the container `id`
442
+
443
+    **Example request**:
444
+
445
+        POST /containers/e90e34656806/stop?t=5 HTTP/1.1
446
+
447
+    **Example response**:
448
+
449
+        HTTP/1.1 204 OK
450
+
451
+    Query Parameters:
452
+
453
+     
454
+
455
+    -   **t** – number of seconds to wait before killing the container
456
+
457
+    Status Codes:
458
+
459
+    -   **204** – no error
460
+    -   **304** – container already stopped
461
+    -   **404** – no such container
462
+    -   **500** – server error
463
+
464
+### Restart a container
465
+
466
+`POST /containers/(id)/restart`
467
+
468
+Restart the container `id`
469
+
470
+    **Example request**:
471
+
472
+        POST /containers/e90e34656806/restart?t=5 HTTP/1.1
473
+
474
+    **Example response**:
475
+
476
+        HTTP/1.1 204 OK
477
+
478
+    Query Parameters:
479
+
480
+     
481
+
482
+    -   **t** – number of seconds to wait before killing the container
483
+
484
+    Status Codes:
485
+
486
+    -   **204** – no error
487
+    -   **404** – no such container
488
+    -   **500** – server error
489
+
490
+### Kill a container
491
+
492
+`POST /containers/(id)/kill`
493
+
494
+Kill the container `id`
495
+
496
+    **Example request**:
497
+
498
+        POST /containers/e90e34656806/kill HTTP/1.1
499
+
500
+    **Example response**:
501
+
502
+        HTTP/1.1 204 OK
503
+
504
+    Query Parameters
505
+
506
+    -   **signal** - Signal to send to the container: integer or string like "SIGINT".
507
+        When not set, SIGKILL is assumed and the call will waits for the container to exit.
508
+
509
+    Status Codes:
510
+
511
+    -   **204** – no error
512
+    -   **404** – no such container
513
+    -   **500** – server error
514
+
515
+### Pause a container
516
+
517
+`POST /containers/(id)/pause`
518
+
519
+Pause the container `id`
520
+
521
+    **Example request**:
522
+
523
+        POST /containers/e90e34656806/pause HTTP/1.1
524
+
525
+    **Example response**:
526
+
527
+        HTTP/1.1 204 OK
528
+
529
+    Status Codes:
530
+
531
+    -   **204** – no error
532
+    -   **404** – no such container
533
+    -   **500** – server error
534
+
535
+### Unpause a container
536
+
537
+`POST /containers/(id)/unpause`
538
+
539
+Unpause the container `id`
540
+
541
+    **Example request**:
542
+
543
+        POST /containers/e90e34656806/unpause HTTP/1.1
544
+
545
+    **Example response**:
546
+
547
+        HTTP/1.1 204 OK
548
+
549
+    Status Codes:
550
+
551
+    -   **204** – no error
552
+    -   **404** – no such container
553
+    -   **500** – server error
554
+
555
+### Attach to a container
556
+
557
+`POST /containers/(id)/attach`
558
+
559
+Attach to the container `id`
560
+
561
+    **Example request**:
562
+
563
+        POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
564
+
565
+    **Example response**:
566
+
567
+        HTTP/1.1 200 OK
568
+        Content-Type: application/vnd.docker.raw-stream
569
+
570
+        {{ STREAM }}
571
+
572
+    Query Parameters:
573
+
574
+     
575
+
576
+    -   **logs** – 1/True/true or 0/False/false, return logs. Default
577
+        false
578
+    -   **stream** – 1/True/true or 0/False/false, return stream.
579
+        Default false
580
+    -   **stdin** – 1/True/true or 0/False/false, if stream=true, attach
581
+        to stdin. Default false
582
+    -   **stdout** – 1/True/true or 0/False/false, if logs=true, return
583
+        stdout log, if stream=true, attach to stdout. Default false
584
+    -   **stderr** – 1/True/true or 0/False/false, if logs=true, return
585
+        stderr log, if stream=true, attach to stderr. Default false
586
+
587
+    Status Codes:
588
+
589
+    -   **200** – no error
590
+    -   **400** – bad parameter
591
+    -   **404** – no such container
592
+    -   **500** – server error
593
+
594
+    **Stream details**:
595
+
596
+    When using the TTY setting is enabled in
597
+    [`POST /containers/create`
598
+    ](../docker_remote_api_v1.9/#post--containers-create "POST /containers/create"),
599
+    the stream is the raw data from the process PTY and client's stdin.
600
+    When the TTY is disabled, then the stream is multiplexed to separate
601
+    stdout and stderr.
602
+
603
+    The format is a **Header** and a **Payload** (frame).
604
+
605
+    **HEADER**
606
+
607
+    The header will contain the information on which stream write the
608
+    stream (stdout or stderr). It also contain the size of the
609
+    associated frame encoded on the last 4 bytes (uint32).
610
+
611
+    It is encoded on the first 8 bytes like this:
612
+
613
+        header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
614
+
615
+    `STREAM_TYPE` can be:
616
+
617
+    -   0: stdin (will be written on stdout)
618
+    -   1: stdout
619
+    -   2: stderr
620
+
621
+    `SIZE1, SIZE2, SIZE3, SIZE4` are the 4 bytes of
622
+    the uint32 size encoded as big endian.
623
+
624
+    **PAYLOAD**
625
+
626
+    The payload is the raw stream.
627
+
628
+    **IMPLEMENTATION**
629
+
630
+    The simplest way to implement the Attach protocol is the following:
631
+
632
+    1.  Read 8 bytes
633
+    2.  chose stdout or stderr depending on the first byte
634
+    3.  Extract the frame size from the last 4 byets
635
+    4.  Read the extracted size and output it on the correct output
636
+    5.  Goto 1)
637
+
638
+### Wait a container
639
+
640
+`POST /containers/(id)/wait`
641
+
642
+Block until container `id` stops, then returns the exit code
643
+
644
+    **Example request**:
645
+
646
+        POST /containers/16253994b7c4/wait HTTP/1.1
647
+
648
+    **Example response**:
649
+
650
+        HTTP/1.1 200 OK
651
+        Content-Type: application/json
652
+
653
+        {"StatusCode":0}
654
+
655
+    Status Codes:
656
+
657
+    -   **200** – no error
658
+    -   **404** – no such container
659
+    -   **500** – server error
660
+
661
+### Remove a container
662
+
663
+`DELETE /containers/(id)`
664
+
665
+Remove the container `id` from the filesystem
666
+
667
+    **Example request**:
668
+
669
+        DELETE /containers/16253994b7c4?v=1 HTTP/1.1
670
+
671
+    **Example response**:
672
+
673
+        HTTP/1.1 204 OK
674
+
675
+    Query Parameters:
676
+
677
+     
678
+
679
+    -   **v** – 1/True/true or 0/False/false, Remove the volumes
680
+        associated to the container. Default false
681
+    -   **force** - 1/True/true or 0/False/false, Kill then remove the container.
682
+        Default false
683
+
684
+    Status Codes:
685
+
686
+    -   **204** – no error
687
+    -   **400** – bad parameter
688
+    -   **404** – no such container
689
+    -   **500** – server error
690
+
691
+### Copy files or folders from a container
692
+
693
+`POST /containers/(id)/copy`
694
+
695
+Copy files or folders of container `id`
696
+
697
+    **Example request**:
698
+
699
+        POST /containers/4fa6e0f0c678/copy HTTP/1.1
700
+        Content-Type: application/json
701
+
702
+        {
703
+             "Resource":"test.txt"
704
+        }
705
+
706
+    **Example response**:
707
+
708
+        HTTP/1.1 200 OK
709
+        Content-Type: application/octet-stream
710
+
711
+        {{ STREAM }}
712
+
713
+    Status Codes:
714
+
715
+    -   **200** – no error
716
+    -   **404** – no such container
717
+    -   **500** – server error
718
+
719
+## 2.2 Images
720
+
721
+### List Images
722
+
723
+`GET /images/json`
724
+
725
+**Example request**:
726
+
727
+        GET /images/json?all=0 HTTP/1.1
728
+
729
+    **Example response**:
730
+
731
+        HTTP/1.1 200 OK
732
+        Content-Type: application/json
733
+
734
+        [
735
+          {
736
+             "RepoTags": [
737
+               "ubuntu:12.04",
738
+               "ubuntu:precise",
739
+               "ubuntu:latest"
740
+             ],
741
+             "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
742
+             "Created": 1365714795,
743
+             "Size": 131506275,
744
+             "VirtualSize": 131506275
745
+          },
746
+          {
747
+             "RepoTags": [
748
+               "ubuntu:12.10",
749
+               "ubuntu:quantal"
750
+             ],
751
+             "ParentId": "27cf784147099545",
752
+             "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
753
+             "Created": 1364102658,
754
+             "Size": 24653,
755
+             "VirtualSize": 180116135
756
+          }
757
+        ]
758
+
759
+
760
+    Query Parameters:
761
+
762
+     
763
+
764
+    -   **all** – 1/True/true or 0/False/false, default false
765
+    -   **filters** – a json encoded value of the filters (a map[string][]string) to process on the images list.
766
+
767
+
768
+
769
+### Create an image
770
+
771
+`POST /images/create`
772
+
773
+Create an image, either by pull it from the registry or by importing it
774
+
775
+    **Example request**:
776
+
777
+        POST /images/create?fromImage=base HTTP/1.1
778
+
779
+    **Example response**:
780
+
781
+        HTTP/1.1 200 OK
782
+        Content-Type: application/json
783
+
784
+        {"status":"Pulling..."}
785
+        {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
786
+        {"error":"Invalid..."}
787
+        ...
788
+
789
+    When using this endpoint to pull an image from the registry, the
790
+    `X-Registry-Auth` header can be used to include
791
+    a base64-encoded AuthConfig object.
792
+
793
+    Query Parameters:
794
+
795
+     
796
+
797
+    -   **fromImage** – name of the image to pull
798
+    -   **fromSrc** – source to import, - means stdin
799
+    -   **repo** – repository
800
+    -   **tag** – tag
801
+    -   **registry** – the registry to pull from
802
+
803
+    Request Headers:
804
+
805
+     
806
+
807
+    -   **X-Registry-Auth** – base64-encoded AuthConfig object
808
+
809
+    Status Codes:
810
+
811
+    -   **200** – no error
812
+    -   **500** – server error
813
+
814
+
815
+
816
+### Inspect an image
817
+
818
+`GET /images/(name)/json`
819
+
820
+Return low-level information on the image `name`
821
+
822
+    **Example request**:
823
+
824
+        GET /images/base/json HTTP/1.1
825
+
826
+    **Example response**:
827
+
828
+        HTTP/1.1 200 OK
829
+        Content-Type: application/json
830
+
831
+        {
832
+             "Created":"2013-03-23T22:24:18.818426-07:00",
833
+             "Container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
834
+             "ContainerConfig":
835
+                     {
836
+                             "Hostname":"",
837
+                             "User":"",
838
+                             "Memory":0,
839
+                             "MemorySwap":0,
840
+                             "AttachStdin":false,
841
+                             "AttachStdout":false,
842
+                             "AttachStderr":false,
843
+                             "PortSpecs":null,
844
+                             "Tty":true,
845
+                             "OpenStdin":true,
846
+                             "StdinOnce":false,
847
+                             "Env":null,
848
+                             "Cmd": ["/bin/bash"],
849
+                             "Dns":null,
850
+                             "Image":"base",
851
+                             "Volumes":null,
852
+                             "VolumesFrom":"",
853
+                             "WorkingDir":""
854
+                     },
855
+             "Id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
856
+             "Parent":"27cf784147099545",
857
+             "Size": 6824592
858
+        }
859
+
860
+    Status Codes:
861
+
862
+    -   **200** – no error
863
+    -   **404** – no such image
864
+    -   **500** – server error
865
+
866
+### Get the history of an image
867
+
868
+`GET /images/(name)/history`
869
+
870
+Return the history of the image `name`
871
+
872
+    **Example request**:
873
+
874
+        GET /images/base/history HTTP/1.1
875
+
876
+    **Example response**:
877
+
878
+        HTTP/1.1 200 OK
879
+        Content-Type: application/json
880
+
881
+        [
882
+             {
883
+                     "Id":"b750fe79269d",
884
+                     "Created":1364102658,
885
+                     "CreatedBy":"/bin/bash"
886
+             },
887
+             {
888
+                     "Id":"27cf78414709",
889
+                     "Created":1364068391,
890
+                     "CreatedBy":""
891
+             }
892
+        ]
893
+
894
+    Status Codes:
895
+
896
+    -   **200** – no error
897
+    -   **404** – no such image
898
+    -   **500** – server error
899
+
900
+### Push an image on the registry
901
+
902
+`POST /images/(name)/push`
903
+
904
+Push the image `name` on the registry
905
+
906
+    **Example request**:
907
+
908
+        POST /images/test/push HTTP/1.1
909
+
910
+    **Example response**:
911
+
912
+        HTTP/1.1 200 OK
913
+        Content-Type: application/json
914
+
915
+        {"status":"Pushing..."}
916
+        {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
917
+        {"error":"Invalid..."}
918
+        ...
919
+
920
+    If you wish to push an image on to a private registry, that image must already have been tagged
921
+    into a repository which references that registry host name and port.  This repository name should 
922
+    then be used in the URL. This mirrors the flow of the CLI.
923
+
924
+    **Example request**:
925
+
926
+        POST /images/registry.acme.com:5000/test/push HTTP/1.1    
927
+    
928
+
929
+    Query Parameters:
930
+
931
+     
932
+
933
+    -   **tag** – the tag to associate with the image on the registry, optional
934
+
935
+    Request Headers:
936
+
937
+     
938
+
939
+    -   **X-Registry-Auth** – include a base64-encoded AuthConfig
940
+        object.
941
+
942
+    Status Codes:
943
+
944
+    -   **200** – no error
945
+    -   **404** – no such image
946
+    -   **500** – server error
947
+
948
+### Tag an image into a repository
949
+
950
+`POST /images/(name)/tag`
951
+
952
+Tag the image `name` into a repository
953
+
954
+    **Example request**:
955
+
956
+        POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
957
+
958
+    **Example response**:
959
+
960
+        HTTP/1.1 201 OK
961
+
962
+    Query Parameters:
963
+
964
+     
965
+
966
+    -   **repo** – The repository to tag in
967
+    -   **force** – 1/True/true or 0/False/false, default false
968
+
969
+    Status Codes:
970
+
971
+    -   **201** – no error
972
+    -   **400** – bad parameter
973
+    -   **404** – no such image
974
+    -   **409** – conflict
975
+    -   **500** – server error
976
+
977
+### Remove an image
978
+
979
+`DELETE /images/(name)`
980
+
981
+Remove the image `name` from the filesystem
982
+
983
+    **Example request**:
984
+
985
+        DELETE /images/test HTTP/1.1
986
+
987
+    **Example response**:
988
+
989
+        HTTP/1.1 200 OK
990
+        Content-type: application/json
991
+
992
+        [
993
+         {"Untagged":"3e2f21a89f"},
994
+         {"Deleted":"3e2f21a89f"},
995
+         {"Deleted":"53b4f83ac9"}
996
+        ]
997
+
998
+    Query Parameters:
999
+
1000
+     
1001
+
1002
+    -   **force** – 1/True/true or 0/False/false, default false
1003
+    -   **noprune** – 1/True/true or 0/False/false, default false
1004
+
1005
+    Status Codes:
1006
+
1007
+    -   **200** – no error
1008
+    -   **404** – no such image
1009
+    -   **409** – conflict
1010
+    -   **500** – server error
1011
+
1012
+### Search images
1013
+
1014
+`GET /images/search`
1015
+
1016
+Search for an image on [Docker Hub](https://hub.docker.com).
1017
+
1018
+> **Note**:
1019
+> The response keys have changed from API v1.6 to reflect the JSON
1020
+> sent by the registry server to the docker daemon's request.
1021
+
1022
+    **Example request**:
1023
+
1024
+        GET /images/search?term=sshd HTTP/1.1
1025
+
1026
+    **Example response**:
1027
+
1028
+        HTTP/1.1 200 OK
1029
+        Content-Type: application/json
1030
+
1031
+        [
1032
+                {
1033
+                    "description": "",
1034
+                    "is_official": false,
1035
+                    "is_automated": false,
1036
+                    "name": "wma55/u1210sshd",
1037
+                    "star_count": 0
1038
+                },
1039
+                {
1040
+                    "description": "",
1041
+                    "is_official": false,
1042
+                    "is_automated": false,
1043
+                    "name": "jdswinbank/sshd",
1044
+                    "star_count": 0
1045
+                },
1046
+                {
1047
+                    "description": "",
1048
+                    "is_official": false,
1049
+                    "is_automated": false,
1050
+                    "name": "vgauthier/sshd",
1051
+                    "star_count": 0
1052
+                }
1053
+        ...
1054
+        ]
1055
+
1056
+    Query Parameters:
1057
+
1058
+     
1059
+
1060
+    -   **term** – term to search
1061
+
1062
+    Status Codes:
1063
+
1064
+    -   **200** – no error
1065
+    -   **500** – server error
1066
+
1067
+## 2.3 Misc
1068
+
1069
+### Build an image from Dockerfile via stdin
1070
+
1071
+`POST /build`
1072
+
1073
+Build an image from Dockerfile via stdin
1074
+
1075
+    **Example request**:
1076
+
1077
+        POST /build HTTP/1.1
1078
+
1079
+        {{ STREAM }}
1080
+
1081
+    **Example response**:
1082
+
1083
+        HTTP/1.1 200 OK
1084
+        Content-Type: application/json
1085
+
1086
+        {"stream":"Step 1..."}
1087
+        {"stream":"..."}
1088
+        {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
1089
+
1090
+    The stream must be a tar archive compressed with one of the
1091
+    following algorithms: identity (no compression), gzip, bzip2, xz.
1092
+
1093
+    The archive must include a file called `Dockerfile`
1094
+    at its root. It may include any number of other files,
1095
+    which will be accessible in the build context (See the [*ADD build
1096
+    command*](/reference/builder/#dockerbuilder)).
1097
+
1098
+    Query Parameters:
1099
+
1100
+     
1101
+
1102
+    -   **t** – repository name (and optionally a tag) to be applied to
1103
+        the resulting image in case of success
1104
+    -   **q** – suppress verbose build output
1105
+    -   **nocache** – do not use the cache when building the image
1106
+    -   **rm** - remove intermediate containers after a successful build (default behavior)
1107
+    -   **forcerm - always remove intermediate containers (includes rm)
1108
+
1109
+    Request Headers:
1110
+
1111
+     
1112
+
1113
+    -   **Content-type** – should be set to
1114
+        `"application/tar"`.
1115
+    -   **X-Registry-Config** – base64-encoded ConfigFile object
1116
+
1117
+    Status Codes:
1118
+
1119
+    -   **200** – no error
1120
+    -   **500** – server error
1121
+
1122
+### Check auth configuration
1123
+
1124
+`POST /auth`
1125
+
1126
+Get the default username and email
1127
+
1128
+    **Example request**:
1129
+
1130
+        POST /auth HTTP/1.1
1131
+        Content-Type: application/json
1132
+
1133
+        {
1134
+             "username":"hannibal",
1135
+             "password:"xxxx",
1136
+             "email":"hannibal@a-team.com",
1137
+             "serveraddress":"https://index.docker.io/v1/"
1138
+        }
1139
+
1140
+    **Example response**:
1141
+
1142
+        HTTP/1.1 200 OK
1143
+
1144
+    Status Codes:
1145
+
1146
+    -   **200** – no error
1147
+    -   **204** – no error
1148
+    -   **500** – server error
1149
+
1150
+### Display system-wide information
1151
+
1152
+`GET /info`
1153
+
1154
+Display system-wide information
1155
+
1156
+    **Example request**:
1157
+
1158
+        GET /info HTTP/1.1
1159
+
1160
+    **Example response**:
1161
+
1162
+        HTTP/1.1 200 OK
1163
+        Content-Type: application/json
1164
+
1165
+        {
1166
+             "Containers":11,
1167
+             "Images":16,
1168
+             "Driver":"btrfs",
1169
+             "ExecutionDriver":"native-0.1",
1170
+             "KernelVersion":"3.12.0-1-amd64"
1171
+             "Debug":false,
1172
+             "NFd": 11,
1173
+             "NGoroutines":21,
1174
+             "NEventsListener":0,
1175
+             "InitPath":"/usr/bin/docker",
1176
+             "IndexServerAddress":["https://index.docker.io/v1/"],
1177
+             "MemoryLimit":true,
1178
+             "SwapLimit":false,
1179
+             "IPv4Forwarding":true
1180
+        }
1181
+
1182
+    Status Codes:
1183
+
1184
+    -   **200** – no error
1185
+    -   **500** – server error
1186
+
1187
+### Show the docker version information
1188
+
1189
+`GET /version`
1190
+
1191
+Show the docker version information
1192
+
1193
+    **Example request**:
1194
+
1195
+        GET /version HTTP/1.1
1196
+
1197
+    **Example response**:
1198
+
1199
+        HTTP/1.1 200 OK
1200
+        Content-Type: application/json
1201
+
1202
+        {
1203
+             "ApiVersion":"1.12",
1204
+             "Version":"0.2.2",
1205
+             "GitCommit":"5a2a5cc+CHANGES",
1206
+             "GoVersion":"go1.0.3"
1207
+        }
1208
+
1209
+    Status Codes:
1210
+
1211
+    -   **200** – no error
1212
+    -   **500** – server error
1213
+
1214
+### Ping the docker server
1215
+
1216
+`GET /_ping`
1217
+
1218
+Ping the docker server
1219
+
1220
+    **Example request**:
1221
+
1222
+        GET /_ping HTTP/1.1
1223
+
1224
+    **Example response**:
1225
+
1226
+        HTTP/1.1 200 OK
1227
+
1228
+        OK
1229
+
1230
+    Status Codes:
1231
+
1232
+    -   **200** - no error
1233
+    -   **500** - server error
1234
+
1235
+### Create a new image from a container's changes
1236
+
1237
+`POST /commit`
1238
+
1239
+Create a new image from a container's changes
1240
+
1241
+    **Example request**:
1242
+
1243
+        POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
1244
+        Content-Type: application/json
1245
+
1246
+        {
1247
+             "Hostname":"",
1248
+             "User":"",
1249
+             "Memory":0,
1250
+             "MemorySwap":0,
1251
+             "AttachStdin":false,
1252
+             "AttachStdout":true,
1253
+             "AttachStderr":true,
1254
+             "PortSpecs":null,
1255
+             "Tty":false,
1256
+             "OpenStdin":false,
1257
+             "StdinOnce":false,
1258
+             "Env":null,
1259
+             "Cmd":[
1260
+                     "date"
1261
+             ],
1262
+             "Volumes":{
1263
+                     "/tmp": {}
1264
+             },
1265
+             "WorkingDir":"",
1266
+             "DisableNetwork": false,
1267
+             "ExposedPorts":{
1268
+                     "22/tcp": {}
1269
+             }
1270
+        }
1271
+
1272
+    **Example response**:
1273
+
1274
+        HTTP/1.1 201 OK
1275
+            Content-Type: application/vnd.docker.raw-stream
1276
+
1277
+        {"Id":"596069db4bf5"}
1278
+
1279
+    Json Parameters:
1280
+
1281
+
1282
+
1283
+    -  **config** - the container's configuration
1284
+
1285
+    Query Parameters:
1286
+
1287
+     
1288
+
1289
+    -   **container** – source container
1290
+    -   **repo** – repository
1291
+    -   **tag** – tag
1292
+    -   **m** – commit message
1293
+    -   **author** – author (e.g., "John Hannibal Smith
1294
+        <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
1295
+
1296
+    Status Codes:
1297
+
1298
+    -   **201** – no error
1299
+    -   **404** – no such container
1300
+    -   **500** – server error
1301
+
1302
+### Monitor Docker's events
1303
+
1304
+`GET /events`
1305
+
1306
+Get events from docker, either in real time via streaming, or
1307
+via polling (using since)
1308
+
1309
+    **Example request**:
1310
+
1311
+        GET /events?since=1374067924
1312
+
1313
+    **Example response**:
1314
+
1315
+        HTTP/1.1 200 OK
1316
+        Content-Type: application/json
1317
+
1318
+        {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
1319
+        {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
1320
+        {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
1321
+        {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
1322
+
1323
+    Query Parameters:
1324
+
1325
+     
1326
+
1327
+    -   **since** – timestamp used for polling
1328
+    -   **until** – timestamp used for polling
1329
+
1330
+    Status Codes:
1331
+
1332
+    -   **200** – no error
1333
+    -   **500** – server error
1334
+
1335
+### Get a tarball containing all images and tags in a repository
1336
+
1337
+`GET /images/(name)/get`
1338
+
1339
+Get a tarball containing all images and metadata for the repository
1340
+specified by `name`.
1341
+
1342
+    **Example request**
1343
+
1344
+        GET /images/ubuntu/get
1345
+
1346
+    **Example response**:
1347
+
1348
+        HTTP/1.1 200 OK
1349
+        Content-Type: application/x-tar
1350
+
1351
+        Binary data stream
1352
+
1353
+    Status Codes:
1354
+
1355
+    -   **200** – no error
1356
+    -   **500** – server error
1357
+
1358
+### Load a tarball with a set of images and tags into docker
1359
+
1360
+`POST /images/load`
1361
+
1362
+Load a set of images and tags into the docker repository.
1363
+
1364
+    **Example request**
1365
+
1366
+        POST /images/load
1367
+
1368
+        Tarball in body
1369
+
1370
+    **Example response**:
1371
+
1372
+        HTTP/1.1 200 OK
1373
+
1374
+    Status Codes:
1375
+
1376
+    -   **200** – no error
1377
+    -   **500** – server error
1378
+
1379
+# 3. Going further
1380
+
1381
+## 3.1 Inside `docker run`
1382
+
1383
+Here are the steps of `docker run`:
1384
+
1385
+- Create the container
1386
+
1387
+- If the status code is 404, it means the image doesn't exists:
1388
+    - Try to pull it
1389
+    - Then retry to create the container
1390
+
1391
+- Start the container
1392
+
1393
+- If you are not in detached mode:
1394
+    - Attach to the container, using logs=1 (to have stdout and
1395
+      stderr from the container's start) and stream=1
1396
+
1397
+- If in detached mode or only stdin is attached:
1398
+    - Display the container's id
1399
+
1400
+## 3.2 Hijacking
1401
+
1402
+In this version of the API, /attach, uses hijacking to transport stdin,
1403
+stdout and stderr on the same socket. This might change in the future.
1404
+
1405
+## 3.3 CORS Requests
1406
+
1407
+To enable cross origin requests to the remote api add the flag
1408
+"–api-enable-cors" when running docker in daemon mode.
1409
+
1410
+    $ docker -d -H="192.168.1.9:2375" --api-enable-cors