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.