summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fdelete-service%2Findex.html
blob: 3587719b8f3cc6bcd7ce40f701d3f52937b96202 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<h1>Delete the service running on the swarm</h1>
<p>The remaining steps in the tutorial don’t use the <code class="language-plaintext highlighter-rouge">helloworld</code> service, so now you can delete the service from 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 rm helloworld</code> to remove the <code class="language-plaintext highlighter-rouge">helloworld</code> service.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service rm helloworld

helloworld
</pre></div>  </li> <li> <p>Run <code class="language-plaintext highlighter-rouge">docker service inspect &lt;SERVICE-ID&gt;</code> to verify that the swarm manager removed the service. The CLI returns a message that the service is not found:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service inspect helloworld
[]
Error: no such service: helloworld
</pre></div>  </li> <li> <p>Even though the service no longer exists, the task containers take a few seconds to clean up. You can use <code class="language-plaintext highlighter-rouge">docker ps</code> on the nodes to verify when the tasks have been removed.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker ps

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS     NAMES
db1651f50347        alpine:latest       "ping docker.com"        44 minutes ago      Up 46 seconds                 helloworld.5.9lkmos2beppihw95vdwxy1j3w
43bf6e532a92        alpine:latest       "ping docker.com"        44 minutes ago      Up 46 seconds                 helloworld.3.a71i8rp6fua79ad43ycocl4t2
5a0fb65d8fa7        alpine:latest       "ping docker.com"        44 minutes ago      Up 45 seconds                 helloworld.2.2jpgensh7d935qdc857pxulfr
afb0ba67076f        alpine:latest       "ping docker.com"        44 minutes ago      Up 46 seconds                 helloworld.4.1c47o7tluz7drve4vkm2m5olx
688172d3bfaa        alpine:latest       "ping docker.com"        45 minutes ago      Up About a minute             helloworld.1.74nbhb3fhud8jfrhigd7s29we

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS     NAMES

</pre></div>  </li> </ol> <h2 id="whats-next">What’s next?</h2> <p>In the next step of the tutorial, you set up a new service and apply a <a href="../rolling-update/index">rolling update</a>.</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">swarm</a>, <a href="https://docs.docker.com/search/?q=service">service</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/delete-service/" class="_attribution-link">https://docs.docker.com/engine/swarm/swarm-tutorial/delete-service/</a>
  </p>
</div>