Add formatter for service inspect

Allows the user to use `pretty` as the format string.
This enables users to put custom format options into their CLI config
just like is supported for `docker ps` and `docker images`

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 347ce7aad3
Component: cli
This commit is contained in:
Brian Goff
2017-06-02 00:10:11 +00:00
committed by Tibor Vass
parent e5821e747b
commit 8d024268f5
2 changed files with 10 additions and 0 deletions
@@ -143,6 +143,13 @@ Docker's client uses this property. If this property is not set, the client
falls back to the default table format. For a list of supported formatting
directives, see the [**Formatting** section in the `docker images` documentation](images.md)
The property `serviceInspectFormat` specifies the default format for `docker
service inspect` output. When the `--format` flag is not provided with the
`docker service inspect` command, Docker's client uses this property. If this
property is not set, the client falls back to the default json format. For a
list of supported formatting directives, see the
[**Formatting** section in the `docker service inspect` documentation](service_inspect.md)
Following is a sample `config.json` file:
{
@@ -151,6 +158,7 @@ Following is a sample `config.json` file:
},
"psFormat": "table {{.ID}}\\t{{.Image}}\\t{{.Command}}\\t{{.Labels}}",
"imagesFormat": "table {{.ID}}\\t{{.Repository}}\\t{{.Tag}}\\t{{.CreatedAt}}",
"serviceInspectFormat": "pretty",
"detachKeys": "ctrl-e,e"
}
@@ -130,6 +130,8 @@ Ports:
PublishedPort = 4443
```
You can also use `--format pretty` for the same effect.
### Finding the number of tasks running as part of a service