From 87b94808dc088d41667b24bb70abcccfe8291b54 Mon Sep 17 00:00:00 2001 From: ILYA Khlopotov Date: Fri, 28 Feb 2014 08:08:01 -0800 Subject: [PATCH] Support json output in --format flag of docker inspect Docker-DCO-1.1-Signed-off-by: ILYA Khlopotov (github: khia) --- docs/sources/reference/commandline/cli.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/sources/reference/commandline/cli.rst b/docs/sources/reference/commandline/cli.rst index 06d57ad359..c8d8a75832 100644 --- a/docs/sources/reference/commandline/cli.rst +++ b/docs/sources/reference/commandline/cli.rst @@ -809,6 +809,19 @@ we ask for the ``HostPort`` field to get the public address. $ sudo docker inspect -format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID +Get config +.......... + +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 config object into JSON + +.. code-block:: bash + + $ sudo docker inspect -format='{{json .config}}' $INSTANCE_ID + + .. _cli_kill: ``kill``