mirror of https://github.com/docker/docs.git
Fix --format split
This commit is contained in:
parent
e4ba76712e
commit
488dff36a0
|
@ -19,55 +19,71 @@ include examples of customizing the output format.
|
||||||
`join` concatenates a list of strings to create a single string.
|
`join` concatenates a list of strings to create a single string.
|
||||||
It puts a separator between each element in the list.
|
It puts a separator between each element in the list.
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
$ docker inspect --format '{{join .Args " , "}}' container
|
```
|
||||||
{% endraw %}
|
docker inspect --format '{{join .Args " , "}}' container
|
||||||
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
|
|
||||||
## json
|
## json
|
||||||
|
|
||||||
`json` encodes an element as a json string.
|
`json` encodes an element as a json string.
|
||||||
|
|
||||||
{% raw %}
|
|
||||||
$ docker inspect --format '{{json .Mounts}}' container
|
{% raw %}
|
||||||
{% endraw %}
|
```
|
||||||
|
docker inspect --format '{{json .Mounts}}' container
|
||||||
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
## lower
|
## lower
|
||||||
|
|
||||||
`lower` transforms a string into its lowercase representation.
|
`lower` transforms a string into its lowercase representation.
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
$ docker inspect --format "{{lower .Name}}" container
|
```
|
||||||
{% endraw %}
|
docker inspect --format "{{lower .Name}}" container
|
||||||
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
## split
|
## split
|
||||||
|
|
||||||
`split` slices a string into a list of strings separated by a separator.
|
`split` slices a string into a list of strings separated by a separator.
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
$ docker inspect --format '{{split (join .Names "/") "/"}}' container
|
```
|
||||||
{% endraw %}
|
docker inspect --format '{{split .Image ":"}}'
|
||||||
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
## title
|
## title
|
||||||
|
|
||||||
`title` capitalizes the first character of a string.
|
`title` capitalizes the first character of a string.
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
$ docker inspect --format "{{title .Name}}" container
|
```
|
||||||
{% endraw %}
|
docker inspect --format "{{title .Name}}" container
|
||||||
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
## upper
|
## upper
|
||||||
|
|
||||||
`upper` transforms a string into its uppercase representation.
|
`upper` transforms a string into its uppercase representation.
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
$ docker inspect --format "{{upper .Name}}" container
|
```
|
||||||
{% endraw %}
|
docker inspect --format "{{upper .Name}}" container
|
||||||
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
||||||
|
|
||||||
## println
|
## println
|
||||||
|
|
||||||
`println` prints each value on a new line.
|
`println` prints each value on a new line.
|
||||||
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
$ docker inspect --format='{{range .NetworkSettings.Networks}}{{println .IPAddress}}{{end}}' container
|
```
|
||||||
{% endraw %}
|
docker inspect --format='{{range .NetworkSettings.Networks}}{{println .IPAddress}}{{end}}' container
|
||||||
|
```
|
||||||
|
{% endraw %}
|
||||||
|
|
Loading…
Reference in New Issue