Error when using Streamlit with Docker

I have followed this tutorial here:
Deploy a Streamlit WebApp with Docker
And when I finally do:
docker run -p 8501:8501 app:latest
The application runs perfectly in my localhost:
error
However, I don’t know why they give me that Network URL. I cannot access from another device to this URL. Instead, I use the one that ifconfig returns me. Then, I can access to the streamlit app, but unfortunately it does not load:


I have tried from other devices and the result is the same.
If I run the app from PyCharm, then I can access to the app from other devices sucessfully.
Why does this happen?
How can I fix this?

You can find the solution here Ec2 streamlit stuck on loading screen while running streamlit hello.

For docker I solved with this docker-compose

version: "3"
services:
  streamlit:
    build: .
    command: "streamlit run src/monitor.py --server.enableCORS false"
    ports:
      - "8501:8501"
    volumes:
      - "./src:/usr/src/app/src"

Using --server.enableCORS false made the magic.

2 Likes