1

I have a flask app, that i want to dockerize, so i have used the following Dockerfile

FROM python:3.8.0-alpine
WORKDIR /project
ADD . /project
RUN pip install -r requirements.txt
EXPOSE 5000
CMD ["python","application.py"]

I built the container with a tag: docker build -t flask-sms-service:latest . and run it with the following command: docker run -d -p 5000:5000 flask-sms-service

I made sure to expose port 5000, for the server to be accessible. But when i access it on 127.0.0.1:5000 i can't access the container.

What did i do wrong?

Kristoffer Tølbøll
  • 3,157
  • 5
  • 34
  • 69

1 Answers1

1

have you used this piece of code

app.run(host= '0.0.0.0')

flask run --host=0.0.0.0 This tells your operating system to listen on all public IPs.

Diwakar SHARMA
  • 573
  • 7
  • 24