title: How do I publish a port at run time of a Docker image on Amazon Ec2?
body: <p>Currently, my <code>Docker</code> image runs as expected when run with the following line inside <code>VSCode's CLI</code>.</p>
  <pre><code>docker run -it -d -p 5000:5000 flaskapp 
  </code></pre>
  <p>This allows me to open up <code>http://localhost:5000/</code> and access it. However, if I were to run it on Docker desktop, it does not allow me to access the localhost. Under my <code>Dockerfile</code>, I have made sure to include <code>EXPOSE 5000</code> inside.</p>
  <pre><code>docker build -t flaskapp:latest .
  </code></pre>
  <p>How do I run a <code>Docker</code> image inside <code>Docker desktop</code> or <code>EC2</code> with the <code>-p</code> flag?</p>