title: Can't see my running Docker Container on localhost
body: <p>I have a simple python application that I want to run in a Docker Image. The application looks like this</p>
  
  <pre><code>from flask import Flask
  
  app = Flask(__name__)
  
  @app.route('/')
  def hello_world():
      return 'Hello World!'
  
  if __name__ == '__main__':
      app.run()
  </code></pre>
  
  <p>and a dockerfile that looks like this:</p>
  
  <pre><code>FROM python:3
  RUN pip install --upgrade pip
  RUN pip install flask
  CMD ["python","app.py"]
  COPY app.py /app.py
  </code></pre>
  
  <p>In addition to these two files the rest of the folder structure looks like this:</p>
  
  <pre><code>├───.idea
  │   └───inspectionProfiles
  ├───static
  ├───templates
  ├───venv
  │   ├───Include
  │   ├───Lib
  │   │   ├───site-packages
  │   │   │   └───pip-19.0.3-py3.7.egg
  │   │   │       ├───EGG-INFO
  │   │   │       └───pip
  │   │   │           ├───_internal
  │   │   │           │   ├───cli
  │   │   │           │   ├───commands
  │   │   │           │   ├───models
  │   │   │           │   ├───operations
  │   │   │           │   ├───req
  │   │   │           │   ├───utils
  │   │   │           │   └───vcs
  │   │   │           └───_vendor
  │   │   │               ├───cachecontrol
  │   │   │               │   └───caches
  │   │   │               ├───certifi
  │   │   │               ├───chardet
  │   │   │               │   └───cli
  │   │   │               ├───colorama
  │   │   │               ├───distlib
  │   │   │               │   └───_backport
  │   │   │               ├───html5lib
  │   │   │               │   ├───filters
  │   │   │               │   ├───treeadapters
  │   │   │               │   ├───treebuilders
  │   │   │               │   ├───treewalkers
  │   │   │               │   └───_trie
  │   │   │               ├───idna
  │   │   │               ├───lockfile
  │   │   │               ├───msgpack
  │   │   │               ├───packaging
  │   │   │               ├───pep517
  │   │   │               ├───pkg_resources
  │   │   │               ├───progress
  │   │   │               ├───pytoml
  │   │   │               ├───requests
  │   │   │               ├───urllib3
  │   │   │               │   ├───contrib
  │   │   │               │   │   └───_securetransport
  │   │   │               │   ├───packages
  │   │   │               │   │   ├───backports
  │   │   │               │   │   └───ssl_match_hostname
  │   │   │               │   └───util
  │   │   │               └───webencodings
  │   │   └───tcl8.6
  │   └───Scripts
  └───__pycache__
  
  </code></pre>
  
  <p>From Powershell I then build the Docker image by writing the command:</p>
  
  <pre><code>docker build . -t myusername/flaskapp
  </code></pre>
  
  <pre><code>PS C:\Users\mypcuser\projects\flask_docker_test&gt; docker build . -t myusername/flaskapp
  Sending build context to Docker daemon  19.49MB
  Step 1/5 : FROM python:3
   ---&gt; f88b2f81f83a
  Step 2/5 : RUN pip install --upgrade pip
   ---&gt; Running in 56dc287d7501
  Requirement already up-to-date: pip in /usr/local/lib/python3.8/site-packages (20.0.2)
  Removing intermediate container 56dc287d7501
   ---&gt; 2dff8ebf09c6
  Step 3/5 : RUN pip install flask
   ---&gt; Running in 5b59f8968a63
  Collecting flask
    Downloading Flask-1.1.1-py2.py3-none-any.whl (94 kB)
  Collecting Werkzeug&gt;=0.15
    Downloading Werkzeug-1.0.0-py2.py3-none-any.whl (298 kB)
  Collecting click&gt;=5.1
    Downloading click-7.1.1-py2.py3-none-any.whl (82 kB)
  Collecting Jinja2&gt;=2.10.1
    Downloading Jinja2-2.11.1-py2.py3-none-any.whl (126 kB)
  Collecting itsdangerous&gt;=0.24
    Downloading itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
  Collecting MarkupSafe&gt;=0.23
    Downloading MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl (32 kB)
  Installing collected packages: Werkzeug, click, MarkupSafe, Jinja2, itsdangerous, flask
  Successfully installed Jinja2-2.11.1 MarkupSafe-1.1.1 Werkzeug-1.0.0 click-7.1.1 flask-1.1.1 itsdangerous-1.1.0
  Removing intermediate container 5b59f8968a63
   ---&gt; 7583bc2d8be6
  Step 4/5 : CMD ["python","app.py"]
   ---&gt; Running in 9394be530612
  Removing intermediate container 9394be530612
   ---&gt; 53e72fb77552
  Step 5/5 : COPY app.py /app.py
   ---&gt; 5925b08ae09e
  Successfully built 5925b08ae09e
  Successfully tagged myusername/flaskapp:latest
  SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
  PS C:\Users\mypcuser\projects\flask_docker_test&gt;
  </code></pre>
  
  <p>I then go ahead and run my app using this command:</p>
  
  <pre><code>docker run -p 5001:5000 -t myusername/flaskapp
  </code></pre>
  
  <p>And get this output:</p>
  
  <pre><code> * Serving Flask app "app" (lazy loading)
   * Environment: production
     WARNING: This is a development server. Do not use it in a production deployment.
     Use a production WSGI server instead.
   * Debug mode: off
   * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
  </code></pre>
  
  <p>But when I go to this URL in both Firefox, Google Chrome and Postman I get this:</p>
  
  <p><a href="https://i.stack.imgur.com/MYGkZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MYGkZ.png" alt="enter image description here"></a></p>