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:
Docker provides a set of basic functions to manipulate template elements. This is the complete list of the available functions with examples:
joinjoin 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 "}}'
jsonjson encodes an element as a json string.
$ docker inspect --format '{{json .Mounts}}' container
lowerlower transforms a string into its lowercase representation.
$ docker inspect --format "{{lower .Name}}" container
splitsplit slices a string into a list of strings separated by a separator.
$ docker inspect --format '{{split (join .Names "/") "/"}}' container
titletitle capitalizes the first character of a string.
$ docker inspect --format "{{title .Name}}" container
upperupper transforms a string into its uppercase representation.
$ docker inspect --format "{{upper .Name}}" container
© 2017 Docker, Inc.
Licensed under the Apache License, Version 2.0.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
Docker, Inc. and other parties may also have trademark rights in other terms used herein.
https://docs.docker.com/v1.13/engine/admin/formatting/