github.com/noxiouz/docker@v0.7.3-0.20160629055221-3d231c78e8c5/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 mode"] 6 advisory = "rc" 7 [menu.main] 8 identifier="inspect-application" 9 parent="swarm-tutorial" 10 weight=17 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: 9uk4639qpg7npwf3fn2aasksr 32 Name: helloworld 33 Mode: REPLICATED 34 Replicas: 1 35 Placement: 36 Strategy: SPREAD 37 UpdateConfig: 38 Parallelism: 1 39 ContainerSpec: 40 Image: alpine 41 Args: 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": "9uk4639qpg7npwf3fn2aasksr", 52 "Version": { 53 "Index": 418 54 }, 55 "CreatedAt": "2016-06-16T21:57:11.622222327Z", 56 "UpdatedAt": "2016-06-16T21:57:11.622222327Z", 57 "Spec": { 58 "Name": "helloworld", 59 "TaskTemplate": { 60 "ContainerSpec": { 61 "Image": "alpine", 62 "Args": [ 63 "ping", 64 "docker.com" 65 ] 66 }, 67 "Resources": { 68 "Limits": {}, 69 "Reservations": {} 70 }, 71 "RestartPolicy": { 72 "Condition": "any", 73 "MaxAttempts": 0 74 }, 75 "Placement": {} 76 }, 77 "Mode": { 78 "Replicated": { 79 "Replicas": 1 80 } 81 }, 82 "UpdateConfig": { 83 "Parallelism": 1 84 }, 85 "EndpointSpec": { 86 "Mode": "vip" 87 } 88 }, 89 "Endpoint": { 90 "Spec": {} 91 } 92 } 93 ] 94 ``` 95 96 4. Run `docker service tasks <SERVICE-ID>` to see which nodes are running the 97 service: 98 99 ``` 100 $ docker service tasks helloworld 101 102 ID NAME SERVICE IMAGE LAST STATE DESIRED STATE NODE 103 8p1vev3fq5zm0mi8g0as41w35 helloworld.1 helloworld alpine Running 3 minutes Running worker2 104 ``` 105 106 In this case, the one instance of the `helloworld` service is running on the 107 `worker2` node. You may see the service running on your manager node. By 108 default, manager nodes in a Swarm can execute tasks just like worker nodes. 109 110 Swarm also shows you the `DESIRED STATE` and `LAST STATE` of the service 111 task so you can see if tasks are running according to the service 112 definition. 113 114 4. Run `docker ps` on the node where the task is running to see details about 115 the container for the task. 116 117 >**Tip**: If `helloworld` is running on a node other than your manager node, 118 you must ssh to that node. 119 120 ```bash 121 $docker ps 122 123 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 124 e609dde94e47 alpine:latest "ping docker.com" 3 minutes ago Up 3 minutes helloworld.1.8p1vev3fq5zm0mi8g0as41w35 125 ``` 126 127 ## What's next? 128 129 Next, you can [change the scale](scale-service.md) for the service running in 130 the swarm.