summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fcreate-swarm%2Findex.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fcreate-swarm%2Findex.html')
-rw-r--r--devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fcreate-swarm%2Findex.html40
1 files changed, 40 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fcreate-swarm%2Findex.html b/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fcreate-swarm%2Findex.html
new file mode 100644
index 00000000..fb108639
--- /dev/null
+++ b/devdocs/docker/engine%2Fswarm%2Fswarm-tutorial%2Fcreate-swarm%2Findex.html
@@ -0,0 +1,40 @@
+<h1>Create a swarm</h1>
+
+<p>After you complete the <a href="../index">tutorial setup</a> steps, you’re ready to create a swarm. Make sure the Docker Engine daemon is started on the host machines.</p> <ol> <li> <p>Open a terminal and ssh into the machine where you want to run your manager node. This tutorial uses a machine named <code class="language-plaintext highlighter-rouge">manager1</code>. If you use Docker Machine, you can connect to it via SSH using the following command:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker-machine ssh manager1
+</pre></div> </li> <li> <p>Run the following command to create a new swarm:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker swarm init --advertise-addr &lt;MANAGER-IP&gt;
+</pre></div> <blockquote> <p><strong>Note</strong>: If you are using Docker Desktop for Mac or Docker Desktop for Windows to test single-node swarm, simply run <code class="language-plaintext highlighter-rouge">docker swarm init</code> with no arguments. There is no need to specify <code class="language-plaintext highlighter-rouge">--advertise-addr</code> in this case. To learn more, see the topic on how to <a href="../index#use-docker-desktop-for-mac-or-docker-desktop-for-windows">Use Docker Desktop for Mac or Docker Desktop for Windows</a> with Swarm.</p> </blockquote> <p>In the tutorial, the following command creates a swarm on the <code class="language-plaintext highlighter-rouge">manager1</code> machine:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker swarm init --advertise-addr 192.168.99.100
+Swarm initialized: current node (dxn1zf6l61qsb1josjja83ngz) is now a manager.
+
+To add a worker to this swarm, run the following command:
+
+ docker swarm join \
+ --token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c \
+ 192.168.99.100:2377
+
+To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
+</pre></div> <p>The <code class="language-plaintext highlighter-rouge">--advertise-addr</code> flag configures the manager node to publish its address as <code class="language-plaintext highlighter-rouge">192.168.99.100</code>. The other nodes in the swarm must be able to access the manager at the IP address.</p> <p>The output includes the commands to join new nodes to the swarm. Nodes will join as managers or workers depending on the value for the <code class="language-plaintext highlighter-rouge">--token</code> flag.</p> </li> <li> <p>Run <code class="language-plaintext highlighter-rouge">docker info</code> to view the current state of the swarm:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker info
+
+Containers: 2
+Running: 0
+Paused: 0
+Stopped: 2
+ ...snip...
+Swarm: active
+ NodeID: dxn1zf6l61qsb1josjja83ngz
+ Is Manager: true
+ Managers: 1
+ Nodes: 1
+ ...snip...
+</pre></div> </li> <li> <p>Run the <code class="language-plaintext highlighter-rouge">docker node ls</code> command to view information about nodes:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker node ls
+
+ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
+dxn1zf6l61qsb1josjja83ngz * manager1 Ready Active Leader
+
+</pre></div> <p>The <code class="language-plaintext highlighter-rouge">*</code> next to the node ID indicates that you’re currently connected on this node.</p> <p>Docker Engine swarm mode automatically names the node for the machine host name. The tutorial covers other columns in later steps.</p> </li> </ol> <h2 id="whats-next">What’s next?</h2> <p>In the next section of the tutorial, we <a href="../add-nodes/index">add two more nodes</a> to the cluster.</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/create-swarm/" class="_attribution-link">https://docs.docker.com/engine/swarm/swarm-tutorial/create-swarm/</a>
+ </p>
+</div>