<?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>port Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/port/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/port/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:29:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Working with Ports in Docker Containers</title>
		<link>https://www.scmgalaxy.com/tutorials/working-with-ports-in-docker-containers/</link>
					<comments>https://www.scmgalaxy.com/tutorials/working-with-ports-in-docker-containers/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Tue, 10 Jul 2018 12:18:26 +0000</pubDate>
				<category><![CDATA[Docker]]></category>
		<category><![CDATA[docker port]]></category>
		<category><![CDATA[expose]]></category>
		<category><![CDATA[port]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=5074</guid>

					<description><![CDATA[<p>Port expose and publish has to happen when a container is created. Just stop the existing container and create a [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/working-with-ports-in-docker-containers/">Working with Ports in Docker Containers</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-5106" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/07/docker-containers1.png" alt="" width="600" height="315" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/07/docker-containers1.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2018/07/docker-containers1-300x158.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p>Port expose and publish has to happen when a container is created. Just stop the existing container and create a new one in its place with the added expose and/or publish options.</p>
<p>By default Docker containers can make connections to the outside world, but the outside world cannot connect to containers. Each outgoing connection will appear to originate from one of the host machine’s own IP addresses thanks to an iptables masquerading rule on the host machine that the Docker server creates when it starts:</p>
<pre class="brush: plain; title: ; notranslate">$ sudo iptables -t nat -L -n
...
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 172.17.0.0/16 0.0.0.0/0</pre>
<p>The Docker server creates a masquerade rule that lets containers connect to IP addresses in the outside world. If you want containers to accept incoming connections, you will need to provide special options when invoking docker run. There are two approaches.</p>
<p><strong>How to map ports to containers?</strong><br />
<strong>Approach 1</strong><br />
First, you can supply -P or &#8211;publish-all=true|false to docker run<br />
or<br />
EXPOSE line in the image’s Dockerfile<br />
or<br />
&#8211;expose &lt;port&gt; commandline flag and maps it to a host port somewhere within an ephemeral port range.</p>
<p><strong>Approach 2</strong><br />
Mapping can be specified explicitly using -p SPEC or &#8211;publish=SPEC option. It allows you to particularize which port on docker server &#8211; which can be any port at all, not just one within the ephemeral port range – you want mapped to which port in the container.</p>
<p><strong>How to EXPOSE Port on running container?</strong></p>
<p><strong>Mehtod 1 &#8211; Using docker commit</strong><br />
Commit your current container to a new image and then do a docker run specifying the new port range and the new image name.</p>
<pre class="brush: plain; title: ; notranslate">$ docker stop containerID 
$ docker commit containerID newImageName:tag
$ docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 newImageName:tag</pre>
<p><strong>Method 2 &#8211; using iptables</strong></p>
<pre class="brush: plain; title: ; notranslate">HOST&gt; iptables -t nat -A DOCKER -p tcp --dport 443 -j DNAT --to-destination 172.17.0.2:443
HOST&gt; iptables -t nat -A POSTROUTING -j MASQUERADE -p tcp --source 172.17.0.2 --destination 172.17.0.2 --dport https
HOST&gt; iptables -A DOCKER -j ACCEPT -p tcp --destination 172.17.0.2 --dport https</pre>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/working-with-ports-in-docker-containers/">Working with Ports in Docker Containers</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/working-with-ports-in-docker-containers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Changing port of ftp and ssh</title>
		<link>https://www.scmgalaxy.com/tutorials/changing-port-of-ftp-and-ssh/</link>
					<comments>https://www.scmgalaxy.com/tutorials/changing-port-of-ftp-and-ssh/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Thu, 07 Dec 2017 12:56:52 +0000</pubDate>
				<category><![CDATA[Shell Script]]></category>
		<category><![CDATA[port]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2192</guid>

					<description><![CDATA[<p>rajeshkumar created the topic: Changing port of ftp and ssh Changing port of ftp and ssh To Change the port [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/changing-port-of-ftp-and-ssh/">Changing port of ftp and ssh</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>rajeshkumar created the topic: Changing port of ftp and ssh</strong><br />
Changing port of ftp and ssh<br />
To Change the port of ssh, edit the file /etc/ssh/sshd_config and add the following line:</p>
<p>port 222</p>
<p>Restart the services of ssh to make the changes effective. Now you need to specify the port number using option &#8216;-p&#8217; whenever you want to access this system.</p>
<p># ssh localhost -p 22</p>
<p>In order to change the port of ftp server, edit the file /etc/vsftpd/vsftpd.conf</p>
<p>listen_port=2100 # # Add thus line</p>
<p>Restart the service of ftp</p>
<p>Now run the following command to check if the listening ports have been changed or not;</p>
<p>ftp localhost 2100</p>
<p>you can even check the open port using the netstat or nmap commands..<br />
Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/changing-port-of-ftp-and-ssh/">Changing port of ftp and ssh</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/changing-port-of-ftp-and-ssh/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
