<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>how to install docker swarm on ubuntu 20.04 Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/how-to-install-docker-swarm-on-ubuntu-20-04/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Mon, 07 Dec 2020 08:51:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>How To Install Docker Swarm On Ubuntu 20.04</title>
		<link>https://www.osradar.com/how-to-install-docker-swarm-on-ubuntu-20-04/</link>
					<comments>https://www.osradar.com/how-to-install-docker-swarm-on-ubuntu-20-04/#respond</comments>
		
		<dc:creator><![CDATA[sabi]]></dc:creator>
		<pubDate>Sat, 05 Dec 2020 04:43:00 +0000</pubDate>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[docker swarm]]></category>
		<category><![CDATA[how to install docker swarm on ubuntu 20.04]]></category>
		<category><![CDATA[how to tutorials]]></category>
		<category><![CDATA[install docker swarm]]></category>
		<category><![CDATA[ubuntu 20.04]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=25928</guid>

					<description><![CDATA[<p>In this tutorial, you&#8217;ll learn that how to Install Docker Swarm on Ubuntu 20.04. Docker Swarm is most popular tool that can be used to create a cluster of docker hosts. You can distribute applications among the hosts with the help of docker cluster created by swarm. Docker Swarm provides high end performance and availablity [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-docker-swarm-on-ubuntu-20-04/">How To Install Docker Swarm On Ubuntu 20.04</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this tutorial, you&#8217;ll learn that <a href="https://www.osradar.com/?p=25928" target="_blank" rel="noreferrer noopener">how to Install Docker Swarm</a> on Ubuntu 20.04. Docker Swarm is most popular tool that can be used to create a cluster of docker hosts. You can distribute applications among the hosts with the help of docker cluster created by swarm. Docker Swarm provides high end performance and availablity containing a manager &amp; worker nodes.Actions are performed by the manager nodes. Let&#8217;s see how to install it on Ubuntu 20.04.</p>



<h2>Update Your System</h2>



<p>Hit the given command in your terminal to update your system.</p>



<pre class="wp-block-preformatted">sudo apt -y update</pre>



<h3>Step 1: Prepare Your Nodes</h3>



<p>To prepare nodes, you&#8217;ve to configure hosts files on each host. In this guide I&#8217;m going to use one Manager node and 2 worker nodes.</p>



<pre class="wp-block-preformatted">sudo nano /etc/hosts</pre>



<p>And add the Ip&#8217;s of your hosts.</p>



<pre class="wp-block-preformatted">192.168.1.10 manager<br>192.168.1.11 worker-1<br>192.168.1.12 worker-2</pre>



<p>Save &amp; close the file.</p>



<p>Verify that you can ping all the hosts using hostname instead of IP&#8217;s.</p>



<h3>Step 2: Install Docker CE on Ubuntu 20.04</h3>



<p>Install the Docker CE on the hosts. Hit the following command to install the required dependencies for Docker CE on Ubuntu 20.04.</p>



<pre class="wp-block-preformatted">sudo apt update<br>sudo apt install apt-transport-https ca-certificates curl software-properties-common</pre>



<p>Then add the Docker CE repository and GPG key on your hosts.</p>



<pre class="wp-block-preformatted">curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"</pre>



<p>Once done, update the packages.</p>



<pre class="wp-block-preformatted">sudo apt update</pre>



<p>Double check that you&#8217;re going to install Docker CE from the official repository of Docker.</p>



<pre class="wp-block-preformatted">root@ubuntu20:~$ sudo apt-cache policy docker-ce
docker-ce:
Installed: (none)
Candidate: 5:19.03.13~3-0~ubuntu-focal
Version table:
5:19.03.13~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
5:19.03.12~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
5:19.03.11~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
5:19.03.10~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
5:19.03.9~3-0~ubuntu-focal 500
500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages</pre>



<p>Verify the status of Docker CE.</p>



<pre class="wp-block-preformatted">root@ubuntu20:~$ <strong>sudo systemctl status docker</strong>
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2020-10-17 16:28:08 EAT; 57s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 2807 (dockerd)
Tasks: 8
Memory: 37.5M
CGroup: /system.slice/docker.service
└─2807 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock</pre>



<p>And add your user to docker group.</p>



<pre class="wp-block-preformatted">sudo usermod -aG docker ${USER}</pre>



<h3>Step 3: Create Docker Swarm Cluster on Ubuntu 20.04</h3>



<p>First start the Docker Swarm on the manager node and then start add the worker nodes to the cluster. To start docker swarm on manager node, type the given command in your terminal.</p>



<pre class="wp-block-preformatted">Swarm initialized: current node (fsuaqqpihi2eabmmq8gldzhpv) is now a manager.
To add a worker to this swarm, run the following command:
sudo docker swarm join --token SWMTKN-1-018kvdektwa74z8fajb5c1u6jyz6qfk4ood8u4qotw7go9jj0p-cfpnh7omy86xcgoh45vau2kaj 192.168.1.10:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.</pre>



<p>From the above result, copy the token<strong> &#8220;Join &#8211;token&#8221;</strong> command to add the worker nodes to the manager node. Here&#8217;s how you can add.</p>



<pre class="wp-block-preformatted">sudo docker swarm join --token SWMTKN-1-13xo81gxpb3ttjh5e335pfrmz9fbnliikgfys7u8l4r8k4m575-2gsjwjs3y1i4kgeua2yu840hw 192.168.1.10:2377
This node joined a swarm as a worker.</pre>



<p>Verify that worker nodes are added to the manager node.</p>



<pre class="wp-block-preformatted">sudo docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
etx5xc5guzftmsqx4naqwvump worker-02 Ready Active 19.03.13
xop4jvrkywz4ldsgwqmfacssc * manager Ready Active Leader 19.03.13
bghrkp7ll1b9lb0ikv8x51gzy worker-01 Ready Active 19.03.13</pre>



<h3>Step 4: Deploy Application in the Cluster</h3>



<p>Now, create the service Nginx web server to run on the port <strong>80</strong> &amp; expose it to the port <strong>8080</strong> on the host. To do this type</p>



<pre class="wp-block-preformatted">root@ubuntu20:~$ sudo docker service create --name web-server --publish 8080:80 nginx:1.13-alpine
pq5txw0p9c1qcjrrl2lw3mh5p
overall progress: 1 out of 1 tasks
1/1: running [==================================================&gt;]
verify: Service converged</pre>



<p>Verify the status of created service using.</p>



<pre class="wp-block-preformatted">sudo docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
pq5txw0p9c1q web-server replicated 1/1 nginx:1.13-alpine *:8080-&gt;80/tcp</pre>



<h3>Step 5: Replicas &amp; Scale the Service</h3>



<p>You&#8217;ve to make replicas of the web-server service in order to access it on the manager and the worker nodes.</p>



<pre class="wp-block-preformatted">sudo docker service scale web-server=3
web-server scaled to 3
overall progress: 3 out of 3 tasks
1/3: running [==================================================>]
2/3: running [==================================================>]
3/3: running [==================================================>]
verify: Service converged
Verify the created service replicas.</pre>



<pre class="wp-block-preformatted">sudo docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
pq5txw0p9c1q web-server replicated 3/3 nginx:1.13-alpine *:8080-&gt;80/tcp</pre>



<p>You can access the service from the web-browser of any host added with the help of IP address and port number like below:<br><strong>192.168.1.10:8080</strong></p>



<p>So, this is how you can install Docker Swarm on Ubuntu 20.04.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/how-to-install-docker-swarm-on-ubuntu-20-04/">How To Install Docker Swarm On Ubuntu 20.04</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/how-to-install-docker-swarm-on-ubuntu-20-04/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
