docs: Clarify environment variable injection options for Docker Compose

- Updated the documentation to specify two methods for injecting environment variables into containers: using the `env_file` option to load all variables or referencing specific variables with the `${VAR_NAME}` syntax.
This commit is contained in:
Mauricio Siu
2026-02-15 21:18:09 -06:00
parent 5fa4611d8d
commit 4424847c8e

View File

@@ -23,7 +23,9 @@ Configure the source of your code, the way your application is built, and also m
The code editor in Dokploy allows you to define environment variables for your Docker Compose deployment. By default, Dokploy saves these variables to a `.env` file in the same directory as your `docker-compose.yml`.
<Callout type="warning">
Environment variables set in the UI are written to the `.env` file, but are **not automatically injected into containers**. To pass variables into a service, use the `env_file` option in your `docker-compose.yml`:
Environment variables set in the UI are written to the `.env` file, but are **not automatically injected into containers**. You have two options:
**1. Inject all variables** — Use the `env_file` option in your `docker-compose.yml` to load every variable from the `.env` file into the container:
```yaml
services:
@@ -31,6 +33,16 @@ services:
env_file:
- .env
```
**2. Use specific variables** — Reference only the variables you need using the standard `${VAR_NAME}` syntax in your `docker-compose.yml`:
```yaml
services:
app:
environment:
- DATABASE_URL=${DATABASE_URL}
- API_KEY=${API_KEY}
```
</Callout>
### Monitoring