I have the config_file wich contains many arguments:
FOO=/foo FOO_1=/bar ... FOO_100=/opt
I need to set my env in docker container, which will contain all these arguments.
I know about --build-arg oprtion, but i dont thinks it'a a good idea, because number of arguments is too big.
So,i dont know how to load environment variables into container correctly.
you can use the --env-file argument while running to the container
ex:
docker run --env-file config.env
check docker run options here https://docs.docker.com/engine/reference/commandline/run/#options
alternative docker-compose.yml
version: "3.7" services: test: image: test: image env_file: - config.env
you can refer for more details https://docs.docker.com/compose/environment-variables/
1.4m articles
1.4m replys
5 comments
56.9k users