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.

Have you got the issue solved ? Im getting the same issue right now.

You can’t directly access container IP of Linux containers on Windows.

Then what is the possible way to access and deploy . And what could be the reason behind it?
I

The reason is simply because the containers are running in a virtual machine as you need Linux for Linux containers, but Docker Desktop runs containers in a VM even on Linux as an attempt to give you the same user experience. So container networks are inside the VM and you can’t access it from outside the VM.

The solution is port mapping. And there is mirrored mode, which I never tried, but I don’t see any example how it would make the container IPs available from the host. I heard about it before the host networking feature so I guess it is similar, but I’m not ana ctive Windows user and haven’t tested it.