github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/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  [menu.main]
     7  identifier="inspect-application"
     8  parent="swarm-tutorial"
     9  weight=17
    10  +++
    11  <![end-metadata]-->
    12  
    13  # Inspect a service on the swarm
    14  
    15  When you have [deployed a service](deploy-service.md) to your swarm, you can use
    16  the Docker CLI to see details about the service running in the swarm.
    17  
    18  1. If you haven't already, open a terminal and ssh into the machine where you
    19  run your manager node. For example, the tutorial uses a machine named
    20  `manager1`.
    21  
    22  2. Run `docker service inspect --pretty <SERVICE-ID>` to display the details
    23  about a service in an easily readable format.
    24  
    25      To see the details on the `helloworld` service:
    26  
    27      ```
    28      $ docker service inspect --pretty helloworld
    29  
    30      ID:		9uk4639qpg7npwf3fn2aasksr
    31      Name:		helloworld
    32      Service Mode:	REPLICATED
    33       Replicas:		1
    34      Placement:
    35      UpdateConfig:
    36       Parallelism:	1
    37      ContainerSpec:
    38       Image:		alpine
    39       Args:	ping docker.com
    40      Resources:
    41      Endpoint Mode:  vip
    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 ps <SERVICE-ID>` to see which nodes are running the
    97  service:
    98  
    99      ```
   100      $ docker service ps helloworld
   101  
   102      NAME                                    IMAGE   NODE     DESIRED STATE  LAST STATE
   103      helloworld.1.8p1vev3fq5zm0mi8g0as41w35  alpine  worker2  Running        Running 3 minutes
   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.