From 1b77149fd46978512609d3dca0341ab15b52b1b9 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 15 Dec 2015 13:35:55 +0000 Subject: [PATCH] Explain 'json' function a bit better Signed-off-by: Bryan Boreham --- docs/reference/commandline/inspect.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/reference/commandline/inspect.md b/docs/reference/commandline/inspect.md index 6620163f70..31a34b20be 100644 --- a/docs/reference/commandline/inspect.md +++ b/docs/reference/commandline/inspect.md @@ -65,11 +65,11 @@ the `HostPort` field to get the public address. $ docker inspect --format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID -**Get config:** +**Get a subsection in JSON format:** -The `.Field` syntax doesn't work when the field contains JSON data, but -the template language's custom `json` function does. The `.config` -section contains complex JSON object, so to grab it as JSON, you use -`json` to convert the configuration object into JSON. +If you request a field which is itself a structure containing other +fields, by default you get a Go-style dump of the inner values. +Docker adds a template function, `json`, which can be applied to get +results in JSON format. - $ docker inspect --format='{{json .config}}' $INSTANCE_ID + $ docker inspect --format='{{json .Config}}' $INSTANCE_ID