Files
docker-docs/compose/env-file.md
Sebastiaan van Stijn 331554f4b3 Fix various links that were generating URLs with .md (#10548)
* Fix incorrect links in compose section

there's a bug causing wrapped links to not work, and replacing
some links to point to the .md file, so that IDE's can check
if the anchors are valid. Also replaced some links to point
to their new location.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

* engine/swarm: update links

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

* Fix various broken links

There's a bug in the "jekyll-relative-links" plugin that causes wrapped links to not work.
Also replacing some links to point to the .md file, so that IDE's can check if the anchors
are valid. Finally, replaced some links to point to their new locations, so that users don't
get redirected..

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-01 12:05:50 +01:00

55 lines
2.0 KiB
Markdown

---
description: Declare default environment variables in a file
keywords: fig, composition, compose, docker, orchestration, environment, env file
title: Declare default environment variables in file
---
Compose supports declaring default environment variables in an environment file
named `.env` placed in the folder where the `docker-compose` command is executed
*(current working directory)*.
## Syntax rules
These syntax rules apply to the `.env` file:
* Compose expects each line in an `env` file to be in `VAR=VAL` format.
* Lines beginning with `#` are processed as comments and ignored.
* Blank lines are ignored.
* There is no special handling of quotation marks. This means that
**they are part of the VAL**.
## Compose file and CLI variables
The environment variables you define here are used for
[variable substitution](/compose/compose-file/index.md#variable-substitution)
in your Compose file, and can also be used to define the following
[CLI variables](/compose/reference/envvars.md):
- `COMPOSE_API_VERSION`
- `COMPOSE_CONVERT_WINDOWS_PATHS`
- `COMPOSE_FILE`
- `COMPOSE_HTTP_TIMEOUT`
- `COMPOSE_TLS_VERSION`
- `COMPOSE_PROJECT_NAME`
- `DOCKER_CERT_PATH`
- `DOCKER_HOST`
- `DOCKER_TLS_VERIFY`
> **Notes**
>
> * Values present in the environment at runtime always override those defined
> inside the `.env` file. Similarly, values passed via command-line arguments
> take precedence as well.
> * Environment variables defined in the `.env` file are not automatically
> visible inside containers. To set container-applicable environment variables,
> follow the guidelines in the topic
> [Environment variables in Compose](/compose/environment-variables.md), which
> describes how to pass shell environment variables through to containers,
> define environment variables in Compose files, and more.
## More Compose documentation
- [User guide](index.md)
- [Command line reference](/compose/reference/index.md)
- [Compose file reference](/compose/compose-file/index.md)