From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- ...2Fswarm-tutorial%2Finspect-service%2Findex.html | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Finspect-service%2Findex.html (limited to 'devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Finspect-service%2Findex.html') diff --git a/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Finspect-service%2Findex.html b/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Finspect-service%2Findex.html new file mode 100644 index 00000000..47a91000 --- /dev/null +++ b/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Finspect-service%2Findex.html @@ -0,0 +1,78 @@ +

Inspect a service on the swarm

+ +

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.

  1. 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.

  2. 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 helloworld service:

    [manager1]$ docker service inspect --pretty helloworld
    +
    +ID:		9uk4639qpg7npwf3fn2aasksr
    +Name:		helloworld
    +Service Mode:	REPLICATED
    + Replicas:		1
    +Placement:
    +UpdateConfig:
    + Parallelism:	1
    +ContainerSpec:
    + Image:		alpine
    + Args:	ping docker.com
    +Resources:
    +Endpoint Mode:  vip
    +

    Tip: To return the service details in json format, run the same command without the --pretty flag.

    [manager1]$ docker service inspect helloworld
    +[
    +{
    +    "ID": "9uk4639qpg7npwf3fn2aasksr",
    +    "Version": {
    +        "Index": 418
    +    },
    +    "CreatedAt": "2016-06-16T21:57:11.622222327Z",
    +    "UpdatedAt": "2016-06-16T21:57:11.622222327Z",
    +    "Spec": {
    +        "Name": "helloworld",
    +        "TaskTemplate": {
    +            "ContainerSpec": {
    +                "Image": "alpine",
    +                "Args": [
    +                    "ping",
    +                    "docker.com"
    +                ]
    +            },
    +            "Resources": {
    +                "Limits": {},
    +                "Reservations": {}
    +            },
    +            "RestartPolicy": {
    +                "Condition": "any",
    +                "MaxAttempts": 0
    +            },
    +            "Placement": {}
    +        },
    +        "Mode": {
    +            "Replicated": {
    +                "Replicas": 1
    +            }
    +        },
    +        "UpdateConfig": {
    +            "Parallelism": 1
    +        },
    +        "EndpointSpec": {
    +            "Mode": "vip"
    +        }
    +    },
    +    "Endpoint": {
    +        "Spec": {}
    +    }
    +}
    +]
    +
  3. Run docker service ps <SERVICE-ID> to see which nodes are running the service:

    [manager1]$ docker service ps helloworld
    +
    +NAME                                    IMAGE   NODE     DESIRED STATE  CURRENT STATE           ERROR               PORTS
    +helloworld.1.8p1vev3fq5zm0mi8g0as41w35  alpine  worker2  Running        Running 3 minutes
    +

    In this case, the one instance of the helloworld service is running on the worker2 node. 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 STATE and CURRENT STATE of the service task so you can see if tasks are running according to the service definition.

  4. Run docker ps on the node where the task is running to see details about the container for the task.

    Tip: If helloworld is running on a node other than your manager node, you must ssh to that node.

    [worker2]$ docker ps
    +
    +CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
    +e609dde94e47        alpine:latest       "ping docker.com"   3 minutes ago       Up 3 minutes                            helloworld.1.8p1vev3fq5zm0mi8g0as41w35
    +

What’s next?

Next, you can change the scale for the service running in the swarm.

+

tutorial, cluster management, swarm mode

+
+

+ © 2019 Docker, Inc.
Licensed under the Apache License, Version 2.0.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
Docker, Inc. and other parties may also have trademark rights in other terms used herein.
+ https://docs.docker.com/engine/swarm/swarm-tutorial/inspect-service/ +

+
-- cgit v1.2.3