Files
docker-docs/engine/admin/formatting.md
Benjamin R. Haskell 362e94b2bc Disable Liquid templating for blocks with {{
Instead of disabling templating for entire files, fix instances
individually by wrapping blocks in:

    ```{% raw %}
    ... content ...
    {% endraw %}```

Signed-off-by: Benjamin R. Haskell <docker@benizi.com>
2016-10-07 00:58:08 -04:00

2.0 KiB

description, keywords, menu, title
description keywords menu title
CLI and log output formatting reference
format, formatting, output, templates, log
main
parent weight
engine_admin 7
Format command and log output

Formatting reference

Docker uses Go templates to allow users manipulate the output format of certain commands and log drivers. Each command a driver provides a detailed list of elements they support in their templates:

Template functions

Docker provides a set of basic functions to manipulate template elements. This is the complete list of the available functions with examples:

Join

Join concatenates a list of strings to create a single string. It puts a separator between each element in the list.

{% raw %}
$ docker ps --format '{{join .Names " or "}}'
{% endraw %}

Json

Json encodes an element as a json string.

{% raw %}
$ docker inspect --format '{{json .Mounts}}' container
{% endraw %}

Lower

Lower turns a string into its lower case representation.

{% raw %}
$ docker inspect --format "{{lower .Name}}" container
{% endraw %}

Split

Split slices a string into a list of strings separated by a separator.

{% raw %}
# docker inspect --format '{{split (join .Names "/") "/"}}' container
{% endraw %}

Title

Title capitalizes a string.

{% raw %}
$ docker inspect --format "{{title .Name}}" container
{% endraw %}

Upper

Upper turns a string into its upper case representation.

{% raw %}
$ docker inspect --format "{{upper .Name}}" container
{% endraw %}