execute a command within docker swarm service
<ol>
<li><p>Initialize swarm mode:</p>

<pre><code>root@ip-172-31-44-207:/home/ubuntu# docker swarm init --advertise-addr 172.31.44.207

Swarm initialized: current node (4mj61oxcc8ulbwd7zedxnz6ce) is now a manager.

To add a worker to this swarm, run the following command:
</code></pre></li>
<li><p>Join the second node:</p>

<pre><code>docker swarm join \
--token SWMTKN-1-4xvddif3wf8tpzcg23tem3zlncth8460srbm7qtyx5qk3ton55-6g05kuek1jhs170d8fub83vs5 \
172.31.44.207:2377
</code></pre></li>
</ol>

<p>To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.</p>

<pre><code># start 2 services
docker service create continuumio/miniconda3 

docker service create --name redis redis:3.0.6


root@ip-172-31-44-207:/home/ubuntu# docker service ls
ID            NAME        REPLICAS  IMAGE                   COMMAND
2yc1xjmita67  miniconda3  0/1       continuumio/miniconda3
c3ptcf2q9zv2  redis       1/1       redis:3.0.6
</code></pre>

<p>As shown above, redis has it's replica while miniconda does <strong>not</strong> seem to be <strong>replicated</strong>.</p>

<p>I do usually log-in to miniconda container to type these commands:</p>

<pre><code>/opt/conda/bin/conda install jupyter -y --quiet &amp;&amp; mkdir /opt/notebooks &amp;&amp; /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser
</code></pre>

<p>The problem is that <code>docker exec -it XXX bash</code> command does not work with swarm mode.</p>