<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>127.0.0.1 on StackOnward</title><link>https://stackonward.com/tags/127.0.0.1/</link><description>Recent content in 127.0.0.1 on StackOnward</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Fri, 11 Sep 2026 04:14:00 +0800</lastBuildDate><atom:link href="https://stackonward.com/tags/127.0.0.1/index.xml" rel="self" type="application/rss+xml"/><item><title>How to Expose Docker Ports: 127.0.0.1, 0.0.0.0, Firewalls</title><link>https://stackonward.com/posts/docker-port-firewall-loopback/</link><pubDate>Fri, 11 Sep 2026 04:14:00 +0800</pubDate><guid>https://stackonward.com/posts/docker-port-firewall-loopback/</guid><description>&lt;p&gt;How to expose Docker ports depends on the process listen address inside the container, the host publish bind, and the firewall or cloud security group in front of the host. Listening on &lt;code&gt;0.0.0.0&lt;/code&gt; inside a container does not put that port on the public internet.&lt;/p&gt;
&lt;figure&gt;
 &lt;img src="https://stackonward.com/images/posts/docker-port-firewall-loopback/en/network-boundaries.svg" alt="Public traffic crosses a cloud security group and host firewall to a reverse proxy; the app and database talk only on the Docker network" loading="lazy" decoding="async"&gt;
 &lt;figcaption&gt;The app and database stay on the Docker network. The public internet reaches only the ports the proxy publishes.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id="how-to-expose-docker-ports-at-each-network-layer"&gt;How to expose Docker ports at each network layer&lt;/h2&gt;
&lt;div class="table-responsive" role="region" aria-label="Scrollable table" tabindex="0"&gt;
 &lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Where it is set&lt;/th&gt;
					&lt;th&gt;Example&lt;/th&gt;
					&lt;th&gt;What it means&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;App process listen&lt;/td&gt;
					&lt;td&gt;&lt;code&gt;0.0.0.0:8080&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Accept 8080 on every interface in this container&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;App process listen&lt;/td&gt;
					&lt;td&gt;&lt;code&gt;127.0.0.1:8080&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Accept 8080 only on this container’s loopback&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;Docker port publish&lt;/td&gt;
					&lt;td&gt;&lt;code&gt;127.0.0.1:8080:8080&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Host-local processes can reach container 8080 on host 8080&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;Docker port publish&lt;/td&gt;
					&lt;td&gt;&lt;code&gt;0.0.0.0:8080:8080&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Every IPv4 address on the host publishes 8080; the public internet may reach it&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;Compose internal access&lt;/td&gt;
					&lt;td&gt;&lt;code&gt;http://app:8080&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;A peer on the same network uses the service name and the container port&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;

&lt;/div&gt;

&lt;p&gt;The two uses of &lt;code&gt;0.0.0.0&lt;/code&gt; are not the same action. Listening on every interface inside the container lets a proxy on the same Docker network connect. Publishing the port onto every host interface widens the host entry.&lt;/p&gt;</description></item></channel></rss>