Docker flask application environment variables

I start the docker container as follows:

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

I'm just trying to transfer the IP address to a flash application so that something can be downloaded from my application. This resource will change from environment to environment, so I want to pass it as an environment variable.

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

I tried to do this:

 import os os.environ.get('IP_AD') 

But nothing seems to be loading. What is the correct way to load the IP_AD passed from docker -e start

+5
source share

Source: https://habr.com/ru/post/1237431/


All Articles