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

docker service inspect


Display detailed information on one or more services

Swarm This command works with the Swarm orchestrator.

Usage

$ docker service inspect [OPTIONS] SERVICE [SERVICE...]
+

Refer to the options section for an overview of available OPTIONS for this command.

Description

Inspects the specified service.

By default, this renders all results in a JSON array. If a format is specified, the given template will be executed for each result.

Go’s text/template package describes all the details of the format.

Note

This is a cluster management command, and must be executed on a swarm manager node. To learn about managers and workers, refer to the Swarm mode section in the documentation.

For example uses of this command, refer to the examples section below.

Options

Name, shorthand Default Description
+--format , -f + Format the output using the given Go template
--pretty Print the information in a human friendly format

Examples

Inspect a service by name or ID

You can inspect a service, either by its name, or ID

For example, given the following service;

$ docker service ls
+ID            NAME   MODE        REPLICAS  IMAGE
+dmu1ept4cxcf  redis  replicated  3/3       redis:3.0.6
+

Both docker service inspect redis, and docker service inspect dmu1ept4cxcf produce the same result:

$ docker service inspect redis
+

The output is in JSON format, for example:

[
+  {
+    "ID": "dmu1ept4cxcfe8k8lhtux3ro3",
+    "Version": {
+      "Index": 12
+    },
+    "CreatedAt": "2016-06-17T18:44:02.558012087Z",
+    "UpdatedAt": "2016-06-17T18:44:02.558012087Z",
+    "Spec": {
+      "Name": "redis",
+      "TaskTemplate": {
+        "ContainerSpec": {
+          "Image": "redis:3.0.6"
+        },
+        "Resources": {
+          "Limits": {},
+          "Reservations": {}
+        },
+        "RestartPolicy": {
+          "Condition": "any",
+          "MaxAttempts": 0
+        },
+        "Placement": {}
+      },
+      "Mode": {
+        "Replicated": {
+          "Replicas": 1
+        }
+      },
+      "UpdateConfig": {},
+      "EndpointSpec": {
+        "Mode": "vip"
+      }
+    },
+    "Endpoint": {
+      "Spec": {}
+    }
+  }
+]
+
$ docker service inspect dmu1ept4cxcf
+
+[
+  {
+    "ID": "dmu1ept4cxcfe8k8lhtux3ro3",
+    "Version": {
+      "Index": 12
+    },
+    ...
+  }
+]
+

Formatting

You can print the inspect output in a human-readable format instead of the default JSON output, by using the --pretty option:

$ docker service inspect --pretty frontend
+
+ID:     c8wgl7q4ndfd52ni6qftkvnnp
+Name:   frontend
+Labels:
+ - org.example.projectname=demo-app
+Service Mode:   REPLICATED
+ Replicas:      5
+Placement:
+UpdateConfig:
+ Parallelism:   0
+ On failure:    pause
+ Max failure ratio: 0
+ContainerSpec:
+ Image:     nginx:alpine
+Resources:
+Networks:   net1
+Endpoint Mode:  vip
+Ports:
+ PublishedPort = 4443
+  Protocol = tcp
+  TargetPort = 443
+  PublishMode = ingress
+

You can also use --format pretty for the same effect.

Find the number of tasks running as part of a service

The --format option can be used to obtain specific information about a service. For example, the following command outputs the number of replicas of the “redis” service.

$ docker service inspect --format='{{.Spec.Mode.Replicated.Replicas}}' redis
+
+10
+

Parent command

Command Description
docker service Manage services
Command Description
docker service create Create a new service
docker service inspect Display detailed information on one or more services
docker service logs Fetch the logs of a service or task
docker service ls List services
docker service ps List the tasks of one or more services
docker service rm Remove one or more services
docker service rollback Revert changes to a service’s configuration
docker service scale Scale one or multiple replicated services
docker service update Update a service
+

+ © 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/reference/commandline/service_inspect/ +

+
-- cgit v1.2.3