docs/_data/engine-cli-edge/docker_service_inspect.yaml

72 lines
3.9 KiB
YAML

command: docker service inspect
short: Display detailed information on one or more services
long: |-
Inspects the specified service. This command has to be run targeting a manager
node.
By default, this renders all results in a JSON array. If a format is specified,
the given template will be executed for each result.
Go's [text/template](http://golang.org/pkg/text/template/) package
describes all the details of the format.
usage: docker service inspect [OPTIONS] SERVICE [SERVICE...]
pname: docker service
plink: docker_service.yaml
options:
- option: format
shorthand: f
value_type: string
description: Format the output using the given Go template
deprecated: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
- option: pretty
value_type: bool
default_value: "false"
description: Print the information in a human friendly format
deprecated: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
examples: "### Inspect a service by name or ID\n\nYou can inspect a service, either
by its *name*, or *ID*\n\nFor example, given the following service;\n\n```bash\n$
docker service ls\nID NAME MODE REPLICAS IMAGE\ndmu1ept4cxcf
\ redis replicated 3/3 redis:3.0.6\n```\n\nBoth `docker service inspect
redis`, and `docker service inspect dmu1ept4cxcf`\nproduce the same result:\n\n```none\n$
docker service inspect redis\n\n[\n {\n \"ID\": \"dmu1ept4cxcfe8k8lhtux3ro3\",\n
\ \"Version\": {\n \"Index\": 12\n },\n \"CreatedAt\":
\"2016-06-17T18:44:02.558012087Z\",\n \"UpdatedAt\": \"2016-06-17T18:44:02.558012087Z\",\n
\ \"Spec\": {\n \"Name\": \"redis\",\n \"TaskTemplate\":
{\n \"ContainerSpec\": {\n \"Image\": \"redis:3.0.6\"\n
\ },\n \"Resources\": {\n \"Limits\":
{},\n \"Reservations\": {}\n },\n \"RestartPolicy\":
{\n \"Condition\": \"any\",\n \"MaxAttempts\":
0\n },\n \"Placement\": {}\n },\n \"Mode\":
{\n \"Replicated\": {\n \"Replicas\": 1\n }\n
\ },\n \"UpdateConfig\": {},\n \"EndpointSpec\":
{\n \"Mode\": \"vip\"\n }\n },\n \"Endpoint\":
{\n \"Spec\": {}\n }\n }\n]\n```\n\n```bash\n$ docker service
inspect dmu1ept4cxcf\n\n[\n {\n \"ID\": \"dmu1ept4cxcfe8k8lhtux3ro3\",\n
\ \"Version\": {\n \"Index\": 12\n },\n ...\n }\n]\n```\n\n###
Formatting\n\nYou can print the inspect output in a human-readable format instead
of the default\nJSON output, by using the `--pretty` option:\n\n```bash\n$ docker
service inspect --pretty frontend\n\nID:\t\tc8wgl7q4ndfd52ni6qftkvnnp\nName:\t\tfrontend\nLabels:\n
- org.example.projectname=demo-app\nService Mode:\tREPLICATED\n Replicas:\t\t5\nPlacement:\nUpdateConfig:\n
Parallelism:\t0\n On failure:\tpause\n Max failure ratio:\t0\nContainerSpec:\n Image:\t\tnginx:alpine\nResources:\nNetworks:\tnet1\nEndpoint
Mode: vip\nPorts:\n PublishedPort = 4443\n Protocol = tcp\n TargetPort = 443\n
\ PublishMode = ingress\n```\n\nYou can also use `--format pretty` for the same
effect.\n\n\n#### Find the number of tasks running as part of a service\n\nThe `--format`
option can be used to obtain specific information about a\nservice. For example,
the following command outputs the number of replicas\nof the \"redis\" service.\n\n```bash\n$
docker service inspect --format='{{.Spec.Mode.Replicated.Replicas}}' redis\n\n10\n```"
deprecated: false
min_api_version: "1.24"
experimental: false
experimentalcli: false
kubernetes: false
swarm: true