github.com/flavio/docker@v0.1.3-0.20170117145210-f63d1a6eec47/docs/reference/commandline/service_inspect.md (about) 1 --- 2 title: "service inspect" 3 description: "The service inspect command description and usage" 4 keywords: "service, inspect" 5 --- 6 7 <!-- This file is maintained within the docker/docker Github 8 repository at https://github.com/docker/docker/. Make all 9 pull requests against that repo. If you see this file in 10 another repository, consider it read-only there, as it will 11 periodically be overwritten by the definitive file. Pull 12 requests which include edits to this file in other repositories 13 will be rejected. 14 --> 15 16 # service inspect 17 18 ```Markdown 19 Usage: docker service inspect [OPTIONS] SERVICE [SERVICE...] 20 21 Display detailed information on one or more services 22 23 Options: 24 -f, --format string Format the output using the given Go template 25 --help Print usage 26 --pretty Print the information in a human friendly format. 27 ``` 28 29 30 Inspects the specified service. This command has to be run targeting a manager 31 node. 32 33 By default, this renders all results in a JSON array. If a format is specified, 34 the given template will be executed for each result. 35 36 Go's [text/template](http://golang.org/pkg/text/template/) package 37 describes all the details of the format. 38 39 ## Examples 40 41 ### Inspecting a service by name or ID 42 43 You can inspect a service, either by its *name*, or *ID* 44 45 For example, given the following service; 46 47 ```bash 48 $ docker service ls 49 ID NAME MODE REPLICAS IMAGE 50 dmu1ept4cxcf redis replicated 3/3 redis:3.0.6 51 ``` 52 53 Both `docker service inspect redis`, and `docker service inspect dmu1ept4cxcf` 54 produce the same result: 55 56 ```bash 57 $ docker service inspect redis 58 [ 59 { 60 "ID": "dmu1ept4cxcfe8k8lhtux3ro3", 61 "Version": { 62 "Index": 12 63 }, 64 "CreatedAt": "2016-06-17T18:44:02.558012087Z", 65 "UpdatedAt": "2016-06-17T18:44:02.558012087Z", 66 "Spec": { 67 "Name": "redis", 68 "TaskTemplate": { 69 "ContainerSpec": { 70 "Image": "redis:3.0.6" 71 }, 72 "Resources": { 73 "Limits": {}, 74 "Reservations": {} 75 }, 76 "RestartPolicy": { 77 "Condition": "any", 78 "MaxAttempts": 0 79 }, 80 "Placement": {} 81 }, 82 "Mode": { 83 "Replicated": { 84 "Replicas": 1 85 } 86 }, 87 "UpdateConfig": {}, 88 "EndpointSpec": { 89 "Mode": "vip" 90 } 91 }, 92 "Endpoint": { 93 "Spec": {} 94 } 95 } 96 ] 97 ``` 98 99 ```bash 100 $ docker service inspect dmu1ept4cxcf 101 [ 102 { 103 "ID": "dmu1ept4cxcfe8k8lhtux3ro3", 104 "Version": { 105 "Index": 12 106 }, 107 ... 108 } 109 ] 110 ``` 111 112 ### Inspect a service using pretty-print 113 114 You can print the inspect output in a human-readable format instead of the default 115 JSON output, by using the `--pretty` option: 116 117 ```bash 118 $ docker service inspect --pretty frontend 119 ID: c8wgl7q4ndfd52ni6qftkvnnp 120 Name: frontend 121 Labels: 122 - org.example.projectname=demo-app 123 Service Mode: REPLICATED 124 Replicas: 5 125 Placement: 126 UpdateConfig: 127 Parallelism: 0 128 On failure: pause 129 Max failure ratio: 0 130 ContainerSpec: 131 Image: nginx:alpine 132 Resources: 133 Networks: net1 134 Endpoint Mode: vip 135 Ports: 136 PublishedPort = 4443 137 Protocol = tcp 138 TargetPort = 443 139 PublishMode = ingress 140 ``` 141 142 You can also use `--format pretty` for the same effect. 143 144 145 ### Finding the number of tasks running as part of a service 146 147 The `--format` option can be used to obtain specific information about a 148 service. For example, the following command outputs the number of replicas 149 of the "redis" service. 150 151 ```bash{% raw %} 152 $ docker service inspect --format='{{.Spec.Mode.Replicated.Replicas}}' redis 153 10 154 {% endraw %}``` 155 156 157 ## Related information 158 159 * [service create](service_create.md) 160 * [service logs](service_logs.md) 161 * [service ls](service_ls.md) 162 * [service rm](service_rm.md) 163 * [service scale](service_scale.md) 164 * [service ps](service_ps.md) 165 * [service update](service_update.md)