mirror of
https://github.com/docker/docs.git
synced 2026-10-31 10:34:26 +03:00
They're usually examples of Go-style text templates. But, Liquid templating is treating them as variable substitutions. E.g., in `engine/reference/commandline/ps.md`:
```bash
$ docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}"
```
is rendered as:
```bash
$ docker ps --filter volume=remote-volume --format "table \t"
```
Solution is to wrap entire files in `{% raw %} ... {% endraw %}` blocks.
1.9 KiB
1.9 KiB
description, keywords, menu, title
| description | keywords | menu | title | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| CLI and log output formatting reference |
|
|
Format command and log output |
{% raw %}
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:
- Docker Images formatting
- Docker Inspect formatting
- Docker Log Tag formatting
- Docker Network Inspect formatting
- Docker PS formatting
- Docker Volume Inspect formatting
- Docker Version formatting
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 turns a string into its upper case representation.
$ docker inspect --format "{{upper .Name}}" container
{% endraw %}