I created the following Flask app:
app.py
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def inicio():
return render_template('index.html')
if __name__=='__main__':
app.run(debug=True)
index.html
<html>
<head>
</head>
<body>
<p>This is a beautiful world indeed</p>
</body>
</html>
Dockerfile
FROM python:3.9-alpine
COPY . app
COPY ./requirements.txt /app/requirements.txt
WORKDIR app
EXPOSE 5000:5000
RUN pip install -r requirements.txt
CMD [ "python", "app.py" ]
Then I created the image and run it:
docker build -t myimage .
docker run -t -i myimage
But when I receive the link, I click on it Running on http://127.0.0.1:5000
and it takes me to a browser. However, nothing displays. Is there anything I am doing wrong?