Im trying to run a test Flask in Docker, but for some reason, i cant connect to it from the host machine, the composition of files is:
pyweb/
|app.py
|Dockerfile
|___app/
|__init__.py
The files content: Dockerfile:
FROM python:2.7
COPY . /pyweb
WORKDIR /pyweb
RUN pip install flask
RUN export FLASK_APP=app.py
ENTRYPOINT ["python"]
CMD ["app.py"]
app.py:
from flask import Flask
from app import app
app/init.py:
from flask import Flask
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def index():
return "Hello, World!"
app.run(host='0.0.0.0')
After running the docker file, and starting the container with docker run -d -p 5000:5000, the response is
* 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://0.0.0.0:5000/ (Press CTRL+C to quit)
But i cant connect form the host machine, it doesnt respond