Home > Back-end >  Docker image not running on http://127.0.0.1:8050/
Docker image not running on http://127.0.0.1:8050/

Time:05-07

I've created a small dash app and trying to run on docker container.I get the following message

Dash is running on http://127.0.0.1:8050/

But when I try opening the link it shows trouble connecting to the page. I tried the solution on Docker image not running on host 8050 but it doesn't work as well.

My dockerfile:

FROM python:3.9

ADD main.py .

RUN pip install dash

RUN pip install plotly

RUN pip install pandas

RUN pip install flask

EXPOSE 8080/tcp

CMD [ "python3" ,"./main.py" ]

CodePudding user response:

As others said, you need to change the port you're exposing to 8050

FROM python:3.9

ADD main.py .

RUN pip install dash

RUN pip install plotly

RUN pip install pandas

RUN pip install flask

EXPOSE 8050

CMD [ "python3" ,"./main.py" ]

to run using docker run

docker run -p 8050:8050 <image_id>

you should then be able to access it at http://127.0.0.1:8050/

CodePudding user response:

Dockerfile like this

FROM python:3.9

WORKDIR /code
COPY main.py /code
RUN pip install dash plotly pandas flask
EXPOSE 8050
CMD python main.py

and build it docker build -t YOURAPP:latest .

and run it docker run -p 8050:8050 YOURAPP:latest

  • Related