I am using streamlit in a docker container. And I am exposing port 8501 to use the app. However, all of a sudden streamlit stopped using localhost and instead uses some IP addresses
docker run -p 8501:8501 -it msmint/msmint:latest
You can now view your Streamlit app in your browser.
Network URL: http://172.17.0.2:8501
External URL: http://96.51.142.239:8501
Now, I cannot use the app anymore. Why was the old behaviour changed and how can I get it back?
The addresses that Streamlit prints to the console don’t really matter. They’re just there to help you find the right address for your machine.
How that works: when we detect that you’re running on a headless server (i.e. a Linux machine without a DISPLAY environment variable) we make Streamlit not open a browser window automatically and also not print “localhost” to the screen. Instead it prints the machine’s local-network-level IP address as well as its internet-level IP address. Again, this is just a change to what gets printed to the screen. There are no other logic changes.
Can you test your docker setup by running python -m http.server 8501 in your container (instead of Streamlit) and seeing if you get something in your browser when you go to localhost:8501 ?
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.