When you have deployed a service to your swarm, you can use the Docker CLI to see details about the service running in the swarm.
If you haven't already, open a terminal and ssh into the machine where you run your manager node. For example, the tutorial uses a machine named
manager1.Run
docker service inspect --pretty <SERVICE-ID>to display the details about a service in an easily readable format.To see the details on the
helloworldservice:TipTo return the service details in json format, run the same command without the
--prettyflag.Run
docker service ps <SERVICE-ID>to see which nodes are running the service:In this case, the one instance of the
helloworldservice is running on theworker2node. You may see the service running on your manager node. By default, manager nodes in a swarm can execute tasks just like worker nodes.Swarm also shows you the
DESIRED STATEandCURRENT STATEof the service task so you can see if tasks are running according to the service definition.Run
docker pson the node where the task is running to see details about the container for the task.TipIf
helloworldis running on a node other than your manager node, you must ssh to that node.
Next steps
Next, you'll change the scale for the service running in the swarm.
Change the scale