title: What does podman run --expose do?
body: <p>I'm new to containers, I don't know Docker, and I'm learning Podman on RHEL.  I'm trying to understand what <code>podman run --expose</code> does.  All <a href="http://docs.podman.io/en/latest/markdown/podman-run.1.html" rel="nofollow noreferrer">podman-run(1)</a> says for the <code>--expose</code> option is <em>&quot;Expose a port, or a range of ports (e.g. --expose=3300-3310) to set up port redirection on the host system.&quot;</em> As I understand/guess it, port redirection is to have an application configured to listen at some port, but have the system expose some other port, and redirect connections to that other to the configured one.  In this case, the application would be the container running instance (right?).  <strong>Edit 2:</strong> That's what the <code>--publish</code> option does.</p>
  <p>There's <a href="https://we-are.bookmyshow.com/understanding-expose-in-dockerfile-266938b6a33d" rel="nofollow noreferrer">this article</a> that expands on Docker documentation on the expose directive in the dockerfile, and says that <em>&quot;The EXPOSE instruction exposes the specified port and makes it available only for inter-container communication.&quot;</em> which doesn't sound equivalent to my reasoning above.</p>
  <p>Can anybody please explain what exactly <code>$ podman run --expose=4321 imaginedimage</code> does and how to check that it does what's expected to do.</p>
  <p><strong>Edit</strong></p>
  <p>...thinking about it again, I shouldn't expect to see that &quot;exposed&quot; port on <code>$ ss -a</code></p>
  <p>I'd better ask for an example of &quot;port redirection on the host system&quot; using <code>--expose</code>.</p>