Application doesn't open on network and external url

When running a container, it doesn’t show anything on the address given.

FROM python:3.8
COPY . /app
EXPOSE 8501
WORKDIR /app
RUN apt-get update
&& \ apt-get install ffmpeg libsm6 libxext6 -y
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt
CMD streamlit run age_gender_prediction.py

This is the docker file. I am running the command

docker run -t -p 8501:8501 age_gender:1.0

It gives the output as

You can now view your Streamlit app in your browser.
Network URL: http://172.17.0.2:8501
External URL: http://103.41.26.105:8501

But the addresses show nothing. Any help is appreciated

When I open localhost:8501, the application works fine.

Hi @Dhruv_Vashist, welcome to the Streamlit community!

The behavior you are seeing is expected, in that the URL you are seeing is relative to the Docker container it’s running in. From a Streamlit perspective, the app can’t see outside of the container, so it tells you where it’s running on the container

While it’s a confusing message, it’s one of those things that we can’t really change on our side, due to how containers work.

Best,
Randy