Reputation: 14145
If I want to provide custom value for ASPNETCORE_ENVIRONMENT
to docker-compose up
cli command how would I do that?
Is it possible to provide this through cli or I need to use docker-compose.yml file (this solution I would like to skip).
Upvotes: 0
Views: 110
Reputation: 1993
Unlike docker-compose run
, docker-compose up
does not provide this - unfortunately. Alternatively, you can make use of env_file
for this:
services:
webapi:
image: aspnetcore-image
env_file:
- .env
By creating a file named .env
(it can be named as desired) and placing it in the appropriate directory (here it is placed in the same directory as docker-compose.yml), docker-compose up
will then export the respective env vars to the docker container.
Upvotes: 1