Simple request fails on Flask in Docker container, here's Dockerfile
:
FROM python:3.8-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
EXPOSE 8000:8000
CMD [ "flask", "run" ]
Here's docker-compose.yml
:
services:
vodolei:
image: my_api:demo
ports:
- 8000:8000
volumes:
- ./src:/app
environment:
FLASK_APP: main.py
FLASK_ENV: development
FLASK_RUN_HOST: 127.0.0.1
FLASK_RUN_PORT: 8000
And here's main.py
:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello!'
Idk, I've checked this multiple times, it must be something obvious which I don't see. But sending a GET request to http://127.0.0.1:8000
returns a general error in Insomnia with the words "Error: Server returned nothing (no headers, no data)".