Browse code

Explain 'json' function a bit better

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

Bryan Boreham authored on 2015/12/15 22:35:55
Showing 1 changed files
... ...
@@ -65,11 +65,11 @@ the `HostPort` field to get the public address.
65 65
 
66 66
     $ docker inspect --format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID
67 67
 
68
-**Get config:**
68
+**Get a subsection in JSON format:**
69 69
 
70
-The `.Field` syntax doesn't work when the field contains JSON data, but
71
-the template language's custom `json` function does. The `.config`
72
-section contains complex JSON object, so to grab it as JSON, you use
73
-`json` to convert the configuration object into JSON.
70
+If you request a field which is itself a structure containing other
71
+fields, by default you get a Go-style dump of the inner values.
72
+Docker adds a template function, `json`, which can be applied to get
73
+results in JSON format.
74 74
 
75
-    $ docker inspect --format='{{json .config}}' $INSTANCE_ID
75
+    $ docker inspect --format='{{json .Config}}' $INSTANCE_ID