summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Finspect-service%2Findex.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Finspect-service%2Findex.html
new repository
Diffstat (limited to 'devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Finspect-service%2Findex.html')
-rw-r--r--devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Finspect-service%2Findex.html78
1 files changed, 78 insertions, 0 deletions
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 @@
+<h1>Inspect a service on the swarm</h1>
+
+<p>When you have <a href="../deploy-service/index">deployed a service</a> to your swarm, you can use the Docker CLI to see details about the service running in the swarm.</p> <ol> <li> <p>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 <code class="language-plaintext highlighter-rouge">manager1</code>.</p> </li> <li> <p>Run <code class="language-plaintext highlighter-rouge">docker service inspect --pretty &lt;SERVICE-ID&gt;</code> to display the details about a service in an easily readable format.</p> <p>To see the details on the <code class="language-plaintext highlighter-rouge">helloworld</code> service:</p> <div class="highlight"><pre class="highlight" data-language="">[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
+</pre></div> <blockquote> <p><strong>Tip</strong>: To return the service details in json format, run the same command without the <code class="language-plaintext highlighter-rouge">--pretty</code> flag.</p> </blockquote> <div class="highlight"><pre class="highlight" data-language="">[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": {}
+ }
+}
+]
+</pre></div> </li> <li> <p>Run <code class="language-plaintext highlighter-rouge">docker service ps &lt;SERVICE-ID&gt;</code> to see which nodes are running the service:</p> <div class="highlight"><pre class="highlight" data-language="">[manager1]$ docker service ps helloworld
+
+NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
+helloworld.1.8p1vev3fq5zm0mi8g0as41w35 alpine worker2 Running Running 3 minutes
+</pre></div> <p>In this case, the one instance of the <code class="language-plaintext highlighter-rouge">helloworld</code> service is running on the <code class="language-plaintext highlighter-rouge">worker2</code> 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.</p> <p>Swarm also shows you the <code class="language-plaintext highlighter-rouge">DESIRED STATE</code> and <code class="language-plaintext highlighter-rouge">CURRENT STATE</code> of the service task so you can see if tasks are running according to the service definition.</p> </li> <li> <p>Run <code class="language-plaintext highlighter-rouge">docker ps</code> on the node where the task is running to see details about the container for the task.</p> <blockquote> <p><strong>Tip</strong>: If <code class="language-plaintext highlighter-rouge">helloworld</code> is running on a node other than your manager node, you must ssh to that node.</p> </blockquote> <div class="highlight"><pre class="highlight" data-language="">[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
+</pre></div> </li> </ol> <h2 id="whats-next">What’s next?</h2> <p>Next, you can <a href="../scale-service/index">change the scale</a> for the service running in the swarm.</p>
+<p><a href="https://docs.docker.com/search/?q=tutorial">tutorial</a>, <a href="https://docs.docker.com/search/?q=cluster%20management">cluster management</a>, <a href="https://docs.docker.com/search/?q=swarm%20mode">swarm mode</a></p>
+<div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2019 Docker, Inc.<br>Licensed under the Apache License, Version 2.0.<br>Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>Docker, Inc. and other parties may also have trademark rights in other terms used herein.<br>
+ <a href="https://docs.docker.com/engine/swarm/swarm-tutorial/inspect-service/" class="_attribution-link">https://docs.docker.com/engine/swarm/swarm-tutorial/inspect-service/</a>
+ </p>
+</div>