Port mapping connects a port on the host machine to a port exposed by a Docker container. Because Streamlit runs inside the container while the browser runs on the host, the browser needs this forwarding route. section 12.2.5
Use the mapping syntax <port-on-host>:<port-on-container>:
- Run the container with -p 8502:8501 when Streamlit listens on container port 8501. section 12.2.5
- Open http://localhost:8502 in the browser; Docker forwards that host request to port 8501 inside the container. section 12.2.5
- Change the host port when deployment requirements differ: Elastic Beanstalk uses 80:8501 so the application is reachable through standard HTTP port 80. section 12.3.5
Local container and cloud deployment
Start locally with docker run -p 8502:8501 fact-frenzy, then browse to localhost:8502. In docker-compose.yml for Elastic Beanstalk, replace the ports entry with "80:8501". section 12.2.5 section 12.3.5
docker run -p 8502:8501 fact-frenzy
Inspect the complete local docker run command that applies port mapping. section 12.2.5

