0

I have created a Flask web-app that serves some static files, and it works just fine locally. I now want to create a Docker image for it and run a container where I can access it.

Running: python server.py Works fine and I can access the application at http://localhost:5000/

I created a Dockerfile like so:

FROM python:3.7
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
CMD python server.py
EXPOSE 8082

When I run: docker run -p 8082:5000 emotional it outputs that it's running and everything is working fine within the container.

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat

but when I navigate to http://localhost:8082 I get ERR_EMPTY_RESPONSE, and when I try http://localhost:5000 (which I know isn't supposed to work) it gives ERR_CONNECTION_REFUSED

Jake Chambers
  • 513
  • 2
  • 6
  • 22

1 Answers1

0

You should expose port 5000 in your dockerfile:

EXPOSE 5000
Veikko
  • 3,372
  • 2
  • 21
  • 31