Quantcast
Viewing all articles
Browse latest Browse all 6176

Docker flask application environment variables

I'm starting a docker container the following way:

docker run -e IP_AD=192.168.99.100 -p 80:80 flask_app

I'm simply trying to pass an IP Address to the flask application so that something can be loaded from my application. This resource will change from environment to environment, so this is the reason I would like to pass it as an environment variable.

Later, I would like to use this variable but from the context of the running flask application. How can I load IP_AD from my flask application and use it as a python variable?

I've tried doing this:

import osos.environ.get('IP_AD')

But it does not seem to be loading anything. What is the correct way to load IP_AD passed from docker run -e


Viewing all articles
Browse latest Browse all 6176

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>