Browse code

bump api to 1.14 & update docs

Docker-DCO-1.1-Signed-off-by: Adrien Folie <folie.adrien@gmail.com> (github: folieadrien)

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