moby/docs/admin/formatting.md
Charles Smith 0bd4111851 add doc for live-restore setting and daemonless containers, fix admin guide menu
Signed-off-by: Charles Smith <charles.smith@docker.com>
(cherry picked from commit cbd07495a3)
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-07-27 20:39:57 +10:00

1.9 KiB

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.

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

Json

Json encodes an element as a json string.

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

Lower

Lower turns a string into its lower case representation.

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

Split

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

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

Title

Title capitalizes a string.

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

Upper

Upper turms a string into its upper case representation.

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