Browse code

doc: Try to standardise JSON examples

Fixed:
* Invalid JSON
* Inconsistent spacing at colon

Expression for binary data streams (line 468 vs. 1474) remain inconsistent.
Could fix that too, if you like.

Signed-off-by: Lorenz Leutgeb <lorenz.leutgeb@gmail.com>

Lorenz Leutgeb authored on 2015/01/04 02:15:40
Showing 1 changed files
... ...
@@ -40,9 +40,9 @@ List containers
40 40
                      "Command": "echo 1",
41 41
                      "Created": 1367854155,
42 42
                      "Status": "Exit 0",
43
-                     "Ports":[{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
44
-                     "SizeRw":12288,
45
-                     "SizeRootFs":0
43
+                     "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
44
+                     "SizeRw": 12288,
45
+                     "SizeRootFs": 0
46 46
              },
47 47
              {
48 48
                      "Id": "9cd87474be90",
... ...
@@ -50,9 +50,9 @@ List containers
50 50
                      "Command": "echo 222222",
51 51
                      "Created": 1367854155,
52 52
                      "Status": "Exit 0",
53
-                     "Ports":[],
54
-                     "SizeRw":12288,
55
-                     "SizeRootFs":0
53
+                     "Ports": [],
54
+                     "SizeRw": 12288,
55
+                     "SizeRootFs": 0
56 56
              },
57 57
              {
58 58
                      "Id": "3176a2479c92",
... ...
@@ -70,9 +70,9 @@ List containers
70 70
                      "Command": "echo 444444444444444444444444444444444",
71 71
                      "Created": 1367854152,
72 72
                      "Status": "Exit 0",
73
-                     "Ports":[],
74
-                     "SizeRw":12288,
75
-                     "SizeRootFs":0
73
+                     "Ports": [],
74
+                     "SizeRw": 12288,
75
+                     "SizeRootFs": 0
76 76
              }
77 77
         ]
78 78
 
... ...
@@ -110,42 +110,42 @@ Create a container
110 110
         Content-Type: application/json
111 111
 
112 112
         {
113
-             "Hostname":"",
113
+             "Hostname": "",
114 114
              "Domainname": "",
115
-             "User":"",
116
-             "Memory":0,
117
-             "MemorySwap":0,
115
+             "User": "",
116
+             "Memory": 0,
117
+             "MemorySwap": 0,
118 118
              "CpuShares": 512,
119 119
              "Cpuset": "0,1",
120
-             "AttachStdin":false,
121
-             "AttachStdout":true,
122
-             "AttachStderr":true,
123
-             "Tty":false,
124
-             "OpenStdin":false,
125
-             "StdinOnce":false,
126
-             "Env":null,
127
-             "Cmd":[
120
+             "AttachStdin": false,
121
+             "AttachStdout": true,
122
+             "AttachStderr": true,
123
+             "Tty": false,
124
+             "OpenStdin": false,
125
+             "StdinOnce": false,
126
+             "Env": null,
127
+             "Cmd": [
128 128
                      "date"
129 129
              ],
130 130
              "Entrypoint": "",
131
-             "Image":"base",
132
-             "Volumes":{
131
+             "Image": "base",
132
+             "Volumes": {
133 133
                      "/tmp": {}
134 134
              },
135
-             "WorkingDir":"",
135
+             "WorkingDir": "",
136 136
              "NetworkDisabled": false,
137
-             "MacAddress":"12:34:56:78:9a:bc",
138
-             "ExposedPorts":{
137
+             "MacAddress": "12:34:56:78:9a:bc",
138
+             "ExposedPorts": {
139 139
                      "22/tcp": {}
140 140
              },
141 141
              "SecurityOpts": [""],
142 142
              "HostConfig": {
143
-               "Binds":["/tmp:/tmp"],
144
-               "Links":["redis3:redis"],
145
-               "LxcConf":{"lxc.utsname":"docker"},
146
-               "PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
147
-               "PublishAllPorts":false,
148
-               "Privileged":false,
143
+               "Binds": ["/tmp:/tmp"],
144
+               "Links": ["redis3:redis"],
145
+               "LxcConf": {"lxc.utsname":"docker"},
146
+               "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
147
+               "PublishAllPorts": false,
148
+               "Privileged": false,
149 149
                "Dns": ["8.8.8.8"],
150 150
                "DnsSearch": [""],
151 151
                "VolumesFrom": ["parent", "other:ro"],
... ...
@@ -163,8 +163,8 @@ Create a container
163 163
         Content-Type: application/json
164 164
 
165 165
         {
166
-             "Id":"f91ddc4b01e079c4481a8340bbbeca4dbd33d6e4a10662e499f8eacbb5bf252b"
167
-             "Warnings":[]
166
+             "Id": "f91ddc4b01e079c4481a8340bbbeca4dbd33d6e4a10662e499f8eacbb5bf252b"
167
+             "Warnings": []
168 168
         }
169 169
 
170 170
 Json Parameters:
... ...
@@ -291,8 +291,7 @@ Return low-level information on the container `id`
291 291
                              "Image": "base",
292 292
                              "Volumes": {},
293 293
                              "VolumesFrom": "",
294
-                             "WorkingDir":""
295
-
294
+                             "WorkingDir": ""
296 295
                      },
297 296
                      "State": {
298 297
                              "Running": false,
... ...
@@ -327,8 +326,8 @@ Return low-level information on the container `id`
327 327
                          },
328 328
                          "Links": ["/name:alias"],
329 329
                          "PublishAllPorts": false,
330
-                         "CapAdd: ["NET_ADMIN"],
331
-                         "CapDrop: ["MKNOD"]
330
+                         "CapAdd": ["NET_ADMIN"],
331
+                         "CapDrop": ["MKNOD"]
332 332
                      }
333 333
         }
334 334
 
... ...
@@ -354,7 +353,7 @@ List processes running inside the container `id`
354 354
         Content-Type: application/json
355 355
 
356 356
         {
357
-             "Titles":[
357
+             "Titles": [
358 358
                      "USER",
359 359
                      "PID",
360 360
                      "%CPU",
... ...
@@ -367,7 +366,7 @@ List processes running inside the container `id`
367 367
                      "TIME",
368 368
                      "COMMAND"
369 369
                      ],
370
-             "Processes":[
370
+             "Processes": [
371 371
                      ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
372 372
                      ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
373 373
              ]
... ...
@@ -432,16 +431,16 @@ Inspect changes on container `id`'s filesystem
432 432
 
433 433
         [
434 434
              {
435
-                     "Path":"/dev",
436
-                     "Kind":0
435
+                     "Path": "/dev",
436
+                     "Kind": 0
437 437
              },
438 438
              {
439
-                     "Path":"/dev/kmsg",
440
-                     "Kind":1
439
+                     "Path": "/dev/kmsg",
440
+                     "Kind": 1
441 441
              },
442 442
              {
443
-                     "Path":"/test",
444
-                     "Kind":1
443
+                     "Path": "/test",
444
+                     "Kind": 1
445 445
              }
446 446
         ]
447 447
 
... ...
@@ -508,12 +507,12 @@ Start the container `id`
508 508
         Content-Type: application/json
509 509
 
510 510
         {
511
-             "Binds":["/tmp:/tmp"],
512
-             "Links":["redis3:redis"],
513
-             "LxcConf":{"lxc.utsname":"docker"},
514
-             "PortBindings":{ "22/tcp": [{ "HostPort": "11022" }] },
515
-             "PublishAllPorts":false,
516
-             "Privileged":false,
511
+             "Binds": ["/tmp:/tmp"],
512
+             "Links": ["redis3:redis"],
513
+             "LxcConf": {"lxc.utsname":"docker"},
514
+             "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
515
+             "PublishAllPorts": false,
516
+             "Privileged": false,
517 517
              "Dns": ["8.8.8.8"],
518 518
              "DnsSearch": [""],
519 519
              "VolumesFrom": ["parent", "other:ro"],
... ...
@@ -783,7 +782,7 @@ Block until container `id` stops, then returns the exit code
783 783
         HTTP/1.1 200 OK
784 784
         Content-Type: application/json
785 785
 
786
-        {"StatusCode":0}
786
+        {"StatusCode": 0}
787 787
 
788 788
 Status Codes:
789 789
 
... ...
@@ -831,7 +830,7 @@ Copy files or folders of container `id`
831 831
         Content-Type: application/json
832 832
 
833 833
         {
834
-             "Resource":"test.txt"
834
+             "Resource": "test.txt"
835 835
         }
836 836
 
837 837
 **Example response**:
... ...
@@ -909,9 +908,9 @@ Create an image, either by pulling it from the registry or by importing it
909 909
         HTTP/1.1 200 OK
910 910
         Content-Type: application/json
911 911
 
912
-        {"status":"Pulling..."}
913
-        {"status":"Pulling", "progress":"1 B/ 100 B", "progressDetail":{"current":1, "total":100}}
914
-        {"error":"Invalid..."}
912
+        {"status": "Pulling..."}
913
+        {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
914
+        {"error": "Invalid..."}
915 915
         ...
916 916
 
917 917
     When using this endpoint to pull an image from the registry, the
... ...
@@ -954,31 +953,31 @@ Return low-level information on the image `name`
954 954
         Content-Type: application/json
955 955
 
956 956
         {
957
-             "Created":"2013-03-23T22:24:18.818426-07:00",
958
-             "Container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
957
+             "Created": "2013-03-23T22:24:18.818426-07:00",
958
+             "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
959 959
              "ContainerConfig":
960 960
                      {
961
-                             "Hostname":"",
962
-                             "User":"",
963
-                             "Memory":0,
964
-                             "MemorySwap":0,
965
-                             "AttachStdin":false,
966
-                             "AttachStdout":false,
967
-                             "AttachStderr":false,
968
-                             "PortSpecs":null,
969
-                             "Tty":true,
970
-                             "OpenStdin":true,
971
-                             "StdinOnce":false,
972
-                             "Env":null,
961
+                             "Hostname": "",
962
+                             "User": "",
963
+                             "Memory": 0,
964
+                             "MemorySwap": 0,
965
+                             "AttachStdin": false,
966
+                             "AttachStdout": false,
967
+                             "AttachStderr": false,
968
+                             "PortSpecs": null,
969
+                             "Tty": true,
970
+                             "OpenStdin": true,
971
+                             "StdinOnce": false,
972
+                             "Env": null,
973 973
                              "Cmd": ["/bin/bash"],
974
-                             "Dns":null,
975
-                             "Image":"base",
976
-                             "Volumes":null,
977
-                             "VolumesFrom":"",
978
-                             "WorkingDir":""
974
+                             "Dns": null,
975
+                             "Image": "base",
976
+                             "Volumes": null,
977
+                             "VolumesFrom": "",
978
+                             "WorkingDir": ""
979 979
                      },
980
-             "Id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
981
-             "Parent":"27cf784147099545",
980
+             "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
981
+             "Parent": "27cf784147099545",
982 982
              "Size": 6824592
983 983
         }
984 984
 
... ...
@@ -1005,14 +1004,14 @@ Return the history of the image `name`
1005 1005
 
1006 1006
         [
1007 1007
              {
1008
-                     "Id":"b750fe79269d",
1009
-                     "Created":1364102658,
1010
-                     "CreatedBy":"/bin/bash"
1008
+                     "Id": "b750fe79269d",
1009
+                     "Created": 1364102658,
1010
+                     "CreatedBy": "/bin/bash"
1011 1011
              },
1012 1012
              {
1013
-                     "Id":"27cf78414709",
1014
-                     "Created":1364068391,
1015
-                     "CreatedBy":""
1013
+                     "Id": "27cf78414709",
1014
+                     "Created": 1364068391,
1015
+                     "CreatedBy": ""
1016 1016
              }
1017 1017
         ]
1018 1018
 
... ...
@@ -1037,9 +1036,9 @@ Push the image `name` on the registry
1037 1037
         HTTP/1.1 200 OK
1038 1038
         Content-Type: application/json
1039 1039
 
1040
-        {"status":"Pushing..."}
1041
-        {"status":"Pushing", "progress":"1/? (n/a)", "progressDetail":{"current":1}}}
1042
-        {"error":"Invalid..."}
1040
+        {"status": "Pushing..."}
1041
+        {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
1042
+        {"error": "Invalid..."}
1043 1043
         ...
1044 1044
 
1045 1045
     If you wish to push an image on to a private registry, that image must already have been tagged
... ...
@@ -1110,9 +1109,9 @@ Remove the image `name` from the filesystem
1110 1110
         Content-type: application/json
1111 1111
 
1112 1112
         [
1113
-         {"Untagged":"3e2f21a89f"},
1114
-         {"Deleted":"3e2f21a89f"},
1115
-         {"Deleted":"53b4f83ac9"}
1113
+         {"Untagged": "3e2f21a89f"},
1114
+         {"Deleted": "3e2f21a89f"},
1115
+         {"Deleted": "53b4f83ac9"}
1116 1116
         ]
1117 1117
 
1118 1118
 Query Parameters:
... ...
@@ -1199,9 +1198,9 @@ Build an image from Dockerfile via stdin
1199 1199
         HTTP/1.1 200 OK
1200 1200
         Content-Type: application/json
1201 1201
 
1202
-        {"stream":"Step 1..."}
1203
-        {"stream":"..."}
1204
-        {"error":"Error...", "errorDetail":{"code": 123, "message": "Error..."}}
1202
+        {"stream": "Step 1..."}
1203
+        {"stream": "..."}
1204
+        {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
1205 1205
 
1206 1206
     The stream must be a tar archive compressed with one of the
1207 1207
     following algorithms: identity (no compression), gzip, bzip2, xz.
... ...
@@ -1242,10 +1241,10 @@ Get the default username and email
1242 1242
         Content-Type: application/json
1243 1243
 
1244 1244
         {
1245
-             "username":"hannibal",
1246
-             "password:"xxxx",
1247
-             "email":"hannibal@a-team.com",
1248
-             "serveraddress":"https://index.docker.io/v1/"
1245
+             "username":" hannibal",
1246
+             "password: "xxxx",
1247
+             "email": "hannibal@a-team.com",
1248
+             "serveraddress": "https://index.docker.io/v1/"
1249 1249
         }
1250 1250
 
1251 1251
 **Example response**:
... ...
@@ -1274,20 +1273,20 @@ Display system-wide information
1274 1274
         Content-Type: application/json
1275 1275
 
1276 1276
         {
1277
-             "Containers":11,
1278
-             "Images":16,
1279
-             "Driver":"btrfs",
1280
-             "ExecutionDriver":"native-0.1",
1281
-             "KernelVersion":"3.12.0-1-amd64"
1282
-             "Debug":false,
1277
+             "Containers": 11,
1278
+             "Images": 16,
1279
+             "Driver": "btrfs",
1280
+             "ExecutionDriver": "native-0.1",
1281
+             "KernelVersion": "3.12.0-1-amd64"
1282
+             "Debug": false,
1283 1283
              "NFd": 11,
1284
-             "NGoroutines":21,
1285
-             "NEventsListener":0,
1286
-             "InitPath":"/usr/bin/docker",
1287
-             "IndexServerAddress":["https://index.docker.io/v1/"],
1288
-             "MemoryLimit":true,
1289
-             "SwapLimit":false,
1290
-             "IPv4Forwarding":true
1284
+             "NGoroutines": 21,
1285
+             "NEventsListener": 0,
1286
+             "InitPath": "/usr/bin/docker",
1287
+             "IndexServerAddress": ["https://index.docker.io/v1/"],
1288
+             "MemoryLimit": true,
1289
+             "SwapLimit": false,
1290
+             "IPv4Forwarding": true
1291 1291
         }
1292 1292
 
1293 1293
 Status Codes:
... ...
@@ -1311,10 +1310,10 @@ Show the docker version information
1311 1311
         Content-Type: application/json
1312 1312
 
1313 1313
         {
1314
-             "ApiVersion":"1.12",
1315
-             "Version":"0.2.2",
1316
-             "GitCommit":"5a2a5cc+CHANGES",
1317
-             "GoVersion":"go1.0.3"
1314
+             "ApiVersion": "1.12",
1315
+             "Version": "0.2.2",
1316
+             "GitCommit": "5a2a5cc+CHANGES",
1317
+             "GoVersion": "go1.0.3"
1318 1318
         }
1319 1319
 
1320 1320
 Status Codes:
... ...
@@ -1356,30 +1355,30 @@ Create a new image from a container's changes
1356 1356
         Content-Type: application/json
1357 1357
 
1358 1358
         {
1359
-             "Hostname":"",
1359
+             "Hostname": "",
1360 1360
              "Domainname": "",
1361
-             "User":"",
1362
-             "Memory":0,
1363
-             "MemorySwap":0,
1361
+             "User": "",
1362
+             "Memory": 0,
1363
+             "MemorySwap": 0,
1364 1364
              "CpuShares": 512,
1365 1365
              "Cpuset": "0,1",
1366
-             "AttachStdin":false,
1367
-             "AttachStdout":true,
1368
-             "AttachStderr":true,
1369
-             "PortSpecs":null,
1370
-             "Tty":false,
1371
-             "OpenStdin":false,
1372
-             "StdinOnce":false,
1373
-             "Env":null,
1374
-             "Cmd":[
1366
+             "AttachStdin": false,
1367
+             "AttachStdout": true,
1368
+             "AttachStderr": true,
1369
+             "PortSpecs": null,
1370
+             "Tty": false,
1371
+             "OpenStdin": false,
1372
+             "StdinOnce": false,
1373
+             "Env": null,
1374
+             "Cmd": [
1375 1375
                      "date"
1376 1376
              ],
1377
-             "Volumes":{
1377
+             "Volumes": {
1378 1378
                      "/tmp": {}
1379 1379
              },
1380
-             "WorkingDir":"",
1380
+             "WorkingDir": "",
1381 1381
              "NetworkDisabled": false,
1382
-             "ExposedPorts":{
1382
+             "ExposedPorts": {
1383 1383
                      "22/tcp": {}
1384 1384
              }
1385 1385
         }
... ...
@@ -1389,7 +1388,7 @@ Create a new image from a container's changes
1389 1389
         HTTP/1.1 201 Created
1390 1390
         Content-Type: application/vnd.docker.raw-stream
1391 1391
 
1392
-        {"Id":"596069db4bf5"}
1392
+        {"Id": "596069db4bf5"}
1393 1393
 
1394 1394
 Json Parameters:
1395 1395
 
... ...
@@ -1434,10 +1433,10 @@ and Docker images will report:
1434 1434
         HTTP/1.1 200 OK
1435 1435
         Content-Type: application/json
1436 1436
 
1437
-        {"status":"create","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
1438
-        {"status":"start","id":"dfdf82bd3881","from":"base:latest","time":1374067924}
1439
-        {"status":"stop","id":"dfdf82bd3881","from":"base:latest","time":1374067966}
1440
-        {"status":"destroy","id":"dfdf82bd3881","from":"base:latest","time":1374067970}
1437
+        {"status": "create", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
1438
+        {"status": "start", "id": "dfdf82bd3881","from": "base:latest", "time":1374067924}
1439
+        {"status": "stop", "id": "dfdf82bd3881","from": "base:latest", "time":1374067966}
1440
+        {"status": "destroy", "id": "dfdf82bd3881","from": "base:latest", "time":1374067970}
1441 1441
 
1442 1442
 Query Parameters:
1443 1443
 
... ...
@@ -1547,7 +1546,7 @@ the root that contains a list of repository and tag names mapped to layer IDs.
1547 1547
 
1548 1548
 ```
1549 1549
 {"hello-world":
1550
-    {"latest":"565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
1550
+    {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
1551 1551
 }
1552 1552
 ```
1553 1553
 
... ...
@@ -1563,11 +1562,11 @@ Sets up an exec instance in a running container `id`
1563 1563
         Content-Type: application/json
1564 1564
 
1565 1565
         {
1566
-	     "AttachStdin":false,
1567
-	     "AttachStdout":true,
1568
-	     "AttachStderr":true,
1569
-	     "Tty":false,
1570
-	     "Cmd":[
1566
+	     "AttachStdin": false,
1567
+	     "AttachStdout": true,
1568
+	     "AttachStderr": true,
1569
+	     "Tty": false,
1570
+	     "Cmd": [
1571 1571
                      "date"
1572 1572
              ],
1573 1573
         }
... ...
@@ -1578,7 +1577,7 @@ Sets up an exec instance in a running container `id`
1578 1578
         Content-Type: application/json
1579 1579
 
1580 1580
         {
1581
-             "Id":"f90e34656806"
1581
+             "Id": "f90e34656806"
1582 1582
         }
1583 1583
 
1584 1584
 Json Parameters:
... ...
@@ -1609,8 +1608,8 @@ interactive session with the `exec` command.
1609 1609
         Content-Type: application/json
1610 1610
 
1611 1611
         {
1612
-	     "Detach":false,
1613
-	     "Tty":false,
1612
+	     "Detach": false,
1613
+	     "Tty": false,
1614 1614
         }
1615 1615
 
1616 1616
 **Example response**: