github.com/kobeld/docker@v1.12.0-rc1/docs/swarm/swarm-tutorial/inspect-service.md (about) 1 <!--[metadata]> 2 +++ 3 title = "Inspect the service" 4 description = "Inspect the application" 5 keywords = ["tutorial, cluster management, swarm"] 6 [menu.main] 7 identifier="inspect-application" 8 parent="swarm-tutorial" 9 weight=17 10 advisory = "rc" 11 +++ 12 <![end-metadata]--> 13 14 # Inspect a service on the Swarm 15 16 When you have [deployed a service](deploy-service.md) to your Swarm, you can use 17 the Docker CLI to see details about the service running in the Swarm. 18 19 1. If you haven't already, open a terminal and ssh into the machine where you 20 run your manager node. For example, the tutorial uses a machine named 21 `manager1`. 22 23 2. Run `docker service inspect --pretty <SERVICE-ID>` to display the details 24 about a service in an easily readable format. 25 26 To see the details on the `helloworld` service: 27 28 ``` 29 $ docker service inspect --pretty helloworld 30 31 ID: 2zs4helqu64f3k3iuwywbk49w 32 Name: helloworld 33 Mode: REPLICATED 34 Scale: 1 35 Placement: 36 Strategy: SPREAD 37 UpdateConfig: 38 Parallelism: 1 39 ContainerSpec: 40 Image: alpine 41 Command: ping docker.com 42 ``` 43 44 >**Tip**: To return the service details in json format, run the same command 45 without the `--pretty` flag. 46 47 ``` 48 $ docker service inspect helloworld 49 [ 50 { 51 "ID": "2zs4helqu64f3k3iuwywbk49w", 52 "Version": { 53 "Index": 16264 54 }, 55 "CreatedAt": "2016-06-06T17:41:11.509146705Z", 56 "UpdatedAt": "2016-06-06T17:41:11.510426385Z", 57 "Spec": { 58 "Name": "helloworld", 59 "ContainerSpec": { 60 "Image": "alpine", 61 "Command": [ 62 "ping", 63 "docker.com" 64 ], 65 "Resources": { 66 "Limits": {}, 67 "Reservations": {} 68 } 69 }, 70 "Mode": { 71 "Replicated": { 72 "Instances": 1 73 } 74 }, 75 "RestartPolicy": {}, 76 "Placement": {}, 77 "UpdateConfig": { 78 "Parallelism": 1 79 }, 80 "EndpointSpec": {} 81 }, 82 "Endpoint": { 83 "Spec": {} 84 } 85 } 86 ] 87 ``` 88 89 4. Run `docker service tasks <SERVICE-ID>` to see which nodes are running the 90 service: 91 92 ``` 93 $ docker service tasks helloworld 94 95 ID NAME SERVICE IMAGE DESIRED STATE LAST STATE NODE 96 1n6wif51j0w840udalgw6hphg helloworld.1 helloworld alpine RUNNING RUNNING 19 minutes manager1 97 ``` 98 99 In this case, the one instance of the `helloworld` service is running on the 100 `manager1` node. Manager nodes in a Swarm can execute tasks just like worker 101 nodes. 102 103 Swarm also shows you the `DESIRED STATE` and `LAST STATE` of the service 104 task so you can see if tasks are running according to the service 105 definition. 106 107 4. Run `docker ps` on the node where the instance of the service is running to 108 see the service container. 109 110 >**Tip**: If `helloworld` is running on a node other than your manager node, 111 you must ssh to that node. 112 113 ```bash 114 $docker ps 115 116 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 117 a0b6c02868ca alpine:latest "ping docker.com" 12 minutes ago Up 12 minutes helloworld.1.1n6wif51j0w840udalgw6hphg 118 ``` 119 120 ## What's next? 121 122 Next, you can [change the scale](scale-service.md) for the service running in 123 the Swarm. 124 125 <p style="margin-bottom:300px"> </p>