After running my docker run command that runs my python script which kicks off a flask app, I see this in my logs:
2019-08-02 18:29:27,519 - <some_file - INFO - Opening connection for subscription [account]
* Serving Flask app "webserver.app" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
2019-08-02 18:29:27,520 - sources.passport.listener - INFO - Opening connection for subscription [lead]
2019-08-02 18:29:27,523 - sources.passport.listener - INFO - Opening connection for subscription [opportunity]
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
...<more logs>
When I hit http://127.0.0.1:5000/metrics
I see my page which is a flask page but when i hit http://localhost:5000/metrics
I do not. Conceptually, what is going on? I thought they would be the same?
This is the docker command that I ran:
docker run -e ENV='dev' -e token=foo:bar <application>
and I'm not even using the -p
flag so what is going on? I'm a bit lost. How am I access the docker flask url without port forwarding?
My code is this:
def start_server():
app.debug = False
app.run()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
threading.Thread(target=start_server).start()
for subscription in SUBSCRIPTION_TYPES:
loop.create_task(subscribe(subscription))
loop.run_forever()