Declare default environment variables in fileEstimated reading time: 1 minute
Compose supports declaring default environment variables in an environment file
.env placed in the folder where the
docker-compose command is executed
(current working directory).
These syntax rules apply to the
- Compose expects each line in an
envfile to be in
- Lines beginning with
#(i.e. comments) are ignored.
- Blank lines are ignored.
- There is no special handling of quotation marks.
Compose file and CLI variables
Note: Values present in the environment at runtime will always override those defined inside the
.envfile. Similarly, values passed via command-line arguments take precedence as well.