title: How to restart multiple containers in a docker swarm
body: <p>I currently have 8 containers across 4 different host machines in my docker setup.</p>
  
  <pre><code>ubuntu@ip-192-168-1-8:~$ docker service ls
  ID            NAME         MODE    REPLICAS  IMAGE
  yyyytxxxxx8  mycontainers  global  8/8     myapplications:latest
  </code></pre>
  
  <p>Running a <code>ps -a</code> on the service yields the following.</p>
  
  <pre><code>ubuntu@ip-192-168-1-8:~$ docker service ps -a yy
  NAME                            IMAGE                        NODE          DESIRED STATE  CURRENT STATE        ERROR  PORTS
   mycontainers1                myapplications:latest:   ip-192-168-1-5 Running        Running 3 hours ago
   \_ mycontainers2                myapplications:latest: ip-192-168-1-6  Running        Running 3 hours ago
   \_ mycontainers3                myapplications:latest:  ip-192-168-1-7  Running        Running 3 hours ago
  \_ mycontainers4                myapplications:latest:  ip-192-168-1-8  Running        Running 3 hours ago
  \_ mycontainers1                myapplications:latest: ip-192-168-1-5  Running        Running 3 hours ago
   \_ mycontainers2                myapplications:latest:  ip-192-168-1-6  Running        Running 3 hours ago
  \_ mycontainers3                myapplications:latest:  ip-192-168-1-7  Running        Running 3 hours ago
  \_ mycontainers4                myapplications:latest:  ip-192-168-1-8  Running        Running 3 hours ago
  </code></pre>
  
  <p>My question is how can i execute a restart of all the containers using the service ID? I dont want to manually log into every node and execute a restart.</p>