What deployment document are you looking at? I’m pretty new to Streamlit but can’t think of anything that you’d be doing within the app itself to deploy it when hosting on your own Ubuntu machine.
Generally Streamlit is not just listening on localhost, but all available interfaces. So once it’s up and running on your Ubuntu machine you should be able to access it at http://<ip_of_ubuntu_machine>:8501 – assuming the firewall or security group on the ubuntu machine allowed inbound connections on TCP port 8501.
Streamlit could be made to listen on a different port, for example the normal web traffic port 80 (it’s an option in the Streamlit config). You could also remap 8501 to 80 easily enough in your docker-compose file.
What you probably actually want to do however is have some sort of reverse proxy that is running on the ubuntu machine, listening on ports 80 (http) and 443 (https), automatically handling SSL certificates, and receiving the incoming web traffic and forwarding it onto the Streamlit app. There are lots of options out there (Nginx, Caddy, Traefik, etc.), which could be running in Docker or outside of it.
I’m hosting a number of Streamlit apps via docker-compose on a linux machine running in Docker swarm mode. I’m personally using Traefik as a reverse proxy, integrated with Lets-Encrypt to automatically generate SSL certificates. In my repos I generally have two docker-compose files, one for local dev and another for production that includes the various annotations for traefik to automatically find and expose the app. I can share an example – note that these aren’t like super optimized or anything but they are working well enough for me for now
Dev: emilytarot/docker-compose.yaml at main · msull/emilytarot · GitHub
Prod: emilytarot/docker-compose.prod.yaml at main · msull/emilytarot · GitHub
When I want to deploy onto production, I SSH into the box and run this script, which setups the required env variables (from a file that is not in git, just on the ubuntu machine), builds the image, and deploys it:
Those deploy labels in the Prod file tell Traefik all it needs to know to deploy the app, and it can do lots of other cool stuff (one of my favorites is adding basic auth, so I can quickly put up a “private” app without actually needing to integrate any auth into the app itself).
I setup my docker swarm (single machine “swarm”) and Traefik using the guides here: