Skip to content

Commit 226a2fd

Browse files
David KarlssonthaJeztah
authored andcommitted
docs: docker inspect: reformat with prettier
Signed-off-by: David Karlsson <david.karlsson@docker.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 802c53f) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 42eca75 commit 226a2fd

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

docs/reference/commandline/inspect.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ By default, `docker inspect` will render results in a JSON array.
2929

3030
If a format is specified, the given template will be executed for each result.
3131

32-
Go's [text/template](https://golang.org/pkg/text/template/) package
33-
describes all the details of the format.
32+
Go's [text/template](https://golang.org/pkg/text/template/) package describes
33+
all the details of the format.
3434

3535
## Specify target type (--type)
3636

3737
`--type container|image|node|network|secret|service|volume|task|plugin`
3838

39-
The `docker inspect` command matches any type of object by either ID or name.
40-
In some cases multiple type of objects (for example, a container and a volume)
39+
The `docker inspect` command matches any type of object by either ID or name. In
40+
some cases multiple type of objects (for example, a container and a volume)
4141
exist with the same name, making the result ambiguous.
4242

4343
To restrict `docker inspect` to a specific type of object, use the `--type`
@@ -80,33 +80,30 @@ $ docker inspect --format='{{.Config.Image}}' $INSTANCE_ID
8080

8181
### List all port bindings
8282

83-
You can loop over arrays and maps in the results to produce simple text
84-
output:
83+
You can loop over arrays and maps in the results to produce simple text output:
8584

8685
```console
8786
$ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' $INSTANCE_ID
8887
```
8988

9089
### Find a specific port mapping
9190

92-
The `.Field` syntax doesn't work when the field name begins with a
93-
number, but the template language's `index` function does. The
94-
`.NetworkSettings.Ports` section contains a map of the internal port
95-
mappings to a list of external address/port objects. To grab just the
96-
numeric public port, you use `index` to find the specific port map, and
97-
then `index` 0 contains the first object inside of that. Then we ask for
98-
the `HostPort` field to get the public address.
91+
The `.Field` syntax doesn't work when the field name begins with a number, but
92+
the template language's `index` function does. The `.NetworkSettings.Ports`
93+
section contains a map of the internal port mappings to a list of external
94+
address/port objects. To grab just the numeric public port, you use `index` to
95+
find the specific port map, and then `index` 0 contains the first object inside
96+
of that. Then we ask for the `HostPort` field to get the public address.
9997

10098
```console
10199
$ docker inspect --format='{{(index (index .NetworkSettings.Ports "8787/tcp") 0).HostPort}}' $INSTANCE_ID
102100
```
103101

104102
### Get a subsection in JSON format
105103

106-
If you request a field which is itself a structure containing other
107-
fields, by default you get a Go-style dump of the inner values.
108-
Docker adds a template function, `json`, which can be applied to get
109-
results in JSON format.
104+
If you request a field which is itself a structure containing other fields, by
105+
default you get a Go-style dump of the inner values. Docker adds a template
106+
function, `json`, which can be applied to get results in JSON format.
110107

111108
```console
112109
$ docker inspect --format='{{json .Config}}' $INSTANCE_ID

0 commit comments

Comments
 (0)