title: Docker Container running.But page isnt working in localhost URL(Page didnt send any data)
body: <p>I am newbie to Docker and Python.I have created a simple python application using Flask .I would like to run it in a Docker container.The docker container shows it is running.However when I access the url ,I get localhost didn’t send any data.</p>
  
  <p>docker container ls shows my container running on localhost and port no 8081</p>
  
  <p>app.py</p>
  
  <pre><code>from flask import Flask, redirect, url_for, request
  
  
  
  app = Flask(__name__)
  
  
   @app.route("/hello", methods=["GET","POST"])
   def hello():
       return "Hello World!"
  
   if __name__ == '__main__':
       app.run(debug=True, port=8081,host='0.0.0.0')
  </code></pre>
  
  <p>Dockerfile</p>
  
  <pre><code>FROM python:2.7
  
  ADD app.py /
  
  RUN pip install flask
  
  EXPOSE 8081 
  
  CMD ["flask", "run", "--host=0.0.0.0"]
  
  CMD ["python", "app.py", "--host=0.0.0.0"]
  </code></pre>
  
  <p>When I run the same app.py in my local environment.I get the desired data on the localhost url. Could someone guide me in the right direction?</p>
  
  <p>Image is tagged <code>dockerimage:latest</code> and I run it with:</p>
  
  <pre class="lang-sh prettyprint-override"><code>docker run -it -p 8081:8081 dockerimage
  </code></pre>
  
  <p>And checking for the container with <code>docker container ls</code> shows:</p>
  
  <pre><code>0.0.0.0:8081-&gt;8081/tcp
  </code></pre>