title: "Connection was reset" error on flask server
body: <p>I'm having an issue with dockers, I followed official docker tutorial to deploy a web app (and luckily a python/flask one) but when I tried to deploy my app when I come to the connection part it failed and reply "Connection was reset"</p>
  
  <p><strong>Code</strong></p>
  
  <hr>
  
  <pre class="lang-py prettyprint-override"><code>    import json
      import threading
      import thread
      import io
  
      from flask import Flask, render_template, request
      from flask_socketio import SocketIO
  
      # Global variables
      app = Flask(__name__)
  
      lock = threading.Semaphore(0)
      IOCReplay.lock = lock
  
      async_mode = None
      socketio = SocketIO(app)
      IOCReplay.socketio = socketio
  
  
      @app.route("/")
      def root():
          return render_template('index.html')
  
      @app.route("/dependencies")
      def getDependencies():
          data = ''
          with open('./dependencies.json') as data_file:
              data = json.load(data_file)
  
          return json.dumps(data)
  
      if __name__ == "__main__":
          socketio.run(app, port=5000)
  </code></pre>
  
  <pre class="lang-sh prettyprint-override"><code>    docker run -d -P guitest:1
      6d95689601b8(...)
  
      docker ps
      CONTAINER ID        IMAGE               COMMAND              
      6d95689601b8        guitest:1           "python test.py"   
  
      CREATED             STATUS              PORTS                       NAMES
      4 seconds ago       Up 2 seconds        0.0.0.0:32771-&gt;5000/tcp     loving_boyd
  
  </code></pre>
  
  <p>Dockerfile is OK.</p>
  
  <h2>Issue</h2>
  
  <p>And so when I'm logging into 0.0.0.0:32771 it says "Connection was reset"</p>
  
  <p>I saw from docker FAQ that to correct this problem, i have to "change the service’s configuration on [my] localhost so that the service accepts requests from all IPs" </p>