Skip to content Skip to sidebar Skip to footer

Not Able To Access Flask Service Running In Docker From Outside The Docker

I have created a flask service inside docker import json from flask import Flask, request app = Flask(__name__) @app.route('/', methods=['GET', 'POST']) def home(): return

Solution 1:

Expose your docker file to an external source(Listener)(Ref)

EXPOSE5000

Ex:-

FROM python:3.7

MAINTAINER sociopath(xyz@gmail.com)

COPY requirements.txt domain.yml config.yml /tmp/COPY data /tmp/data
COPY helper /tmp/helper
COPY models /tmp/models
COPY app.py /tmp/app.py

WORKDIR /tmp

RUN pip install -r requirements.txt
EXPOSE 5000
CMD flask run --host=0.0.0.0

Post a Comment for "Not Able To Access Flask Service Running In Docker From Outside The Docker"