Files
docker-docs/config/formatting.md
Misty Stanley-Jones 1b343beca4 Clean up information architecture (#5893)
- Move /engine/admin/ and /engine/userguide/ topics to /config/ and /develop/
- Get rid of some stub topics that are no longer needed
- Rename /engine/article-img/ to /engine/images/
- Mark ambassador linking topic as obsolete
- Flesh out multistage build topic
- Reorganize some terribly obsolete content in other files
2018-02-01 15:25:43 -08:00

65 lines
1.6 KiB
Markdown

---
description: CLI and log output formatting reference
keywords: format, formatting, output, templates, log
title: Format command and log output
redirect_from:
- /engine/admin/formatting/
---
Docker uses [Go templates](https://golang.org/pkg/text/template/) which you can
use to manipulate the output format of certain commands and log drivers.
Docker provides a set of basic functions to manipulate template elements.
All of these examples use the `docker inspect` command, but many other CLI
commands have a `--format` flag, and many of the CLI command references
include examples of customizing the output format.
## join
`join` concatenates a list of strings to create a single string.
It puts a separator between each element in the list.
{% raw %}
$ docker inspect --format '{{join .Args " , "}}' container
{% endraw %}
## json
`json` encodes an element as a json string.
{% raw %}
$ docker inspect --format '{{json .Mounts}}' container
{% endraw %}
## lower
`lower` transforms a string into its lowercase 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 the first character of a string.
{% raw %}
$ docker inspect --format "{{title .Name}}" container
{% endraw %}
## upper
`upper` transforms a string into its uppercase representation.
{% raw %}
$ docker inspect --format "{{upper .Name}}" container
{% endraw %}