From 4424847c8ed45dc4d3f39b042b92414add890724 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Sun, 15 Feb 2026 21:18:09 -0600 Subject: [PATCH] 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. --- .../content/docs/core/docker-compose/index.mdx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/docs/content/docs/core/docker-compose/index.mdx b/apps/docs/content/docs/core/docker-compose/index.mdx index 10b72c9..762f6c7 100644 --- a/apps/docs/content/docs/core/docker-compose/index.mdx +++ b/apps/docs/content/docs/core/docker-compose/index.mdx @@ -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`. -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} +``` ### Monitoring