title: "CURL: connection refused" when trying to curl localhost: 5000 to container flask
body: <p>I have a problem executing the command <code>curl localhost:5000</code>, can someone give me some help?</p>
  <pre><code>jesayafernando9@pod-jesayafernando9-node01:~/latihan04$ sudo docker run -d -p 5000:5000 --name flask04 jesaya/flask-latihan04
  14acc48334060ba79c9f3dd5eaafcc0ea0767d29c531eac0d48ae6649af54e2c
  jesayafernando9@pod-jesayafernando9-node01:~/latihan04$ curl localhost:5000
  curl: (7) Failed to connect to localhost port 5000: Connection refused
  jesayafernando9@pod-jesayafernando9-node01:~/latihan04$
  </code></pre>
  <p>app.py script</p>
  <pre><code>from flask import Flask
  app = Flask(__name__)
  
  @app.route('/')
  def hello_world():
          return 'Hey, we have Flask in a Docker container!'
  
  
      if __name__ == '__main__':
              app.run(debug=True, host='0.0.0.0')
  </code></pre>
  <p>requirements.txt</p>
  <pre><code>Flask==0.10.1
  </code></pre>
  <p>Dockerfile</p>
  <pre><code>FROM ubuntu:16.04
  RUN mkdir /app
  RUN apt-get update -y &amp;&amp; \
          apt-get install python-pip python-dev -y
  
  COPY ./requirements.txt /app
  COPY . /app
  
  WORKDIR /app
  RUN pip install -r requirements.txt
  
  ENTRYPOINT [&quot;python&quot;]
  CMD [&quot;app.py&quot;]
  </code></pre>