I was attempting to write a flask python app and have it containerized on Windows but going to localhost:5000 resulted in an empty response.
FROM python:3
...
WORKDIR /opt/famdo/src
CMD ["gunicorn", "-b", "127.0.0.1:8000", "wsgi:app"]
EXPOSE 8000
The above Dockerfile works perfectly fine in Linux if you hit localhost:8000 from the host. From windows it doesn’t work. The solution is simple!
FROM python:3
...
WORKDIR /opt/famdo/src
CMD ["gunicorn", "-b", "0.0.0.0:8000", "wsgi:app"]
EXPOSE 8000
Bind to 0.0.0.0 instead of 127.0.0.1 and voila! You can now hit that endpoint via localhost in windows.