From 53747fccf394f2d33a3090fd99dd9b1a067de3ba Mon Sep 17 00:00:00 2001 From: Adam Monsen Date: Thu, 30 Oct 2025 18:23:46 -0700 Subject: [PATCH 1/2] document yaml-ish .env file syntax also, add example showing spacing rules Signed-off-by: Adam Monsen --- .../how-tos/environment-variables/variable-interpolation.md | 4 ++++ content/reference/compose-file/services.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/content/manuals/compose/how-tos/environment-variables/variable-interpolation.md b/content/manuals/compose/how-tos/environment-variables/variable-interpolation.md index 820836559b4f..ae42fc1ae92e 100644 --- a/content/manuals/compose/how-tos/environment-variables/variable-interpolation.md +++ b/content/manuals/compose/how-tos/environment-variables/variable-interpolation.md @@ -130,9 +130,13 @@ The following syntax rules apply to environment files: - Blank lines are ignored. - Unquoted and double-quoted (`"`) values have interpolation applied. - Each line represents a key-value pair. Values can optionally be quoted. +- Delimiter separating key and value can be either `=` or `:`. +- Spaces before and after value are ignored. - `VAR=VAL` -> `VAL` - `VAR="VAL"` -> `VAL` - `VAR='VAL'` -> `VAL` + - `VAR: VAL` -> `VAL` + - `VAR = VAL ` -> `VAL` - Inline comments for unquoted values must be preceded with a space. - `VAR=VAL # comment` -> `VAL` - `VAR=VAL# not a comment` -> `VAL# not a comment` diff --git a/content/reference/compose-file/services.md b/content/reference/compose-file/services.md index c3acb191bd80..12cf5703b5d4 100644 --- a/content/reference/compose-file/services.md +++ b/content/reference/compose-file/services.md @@ -688,9 +688,13 @@ Each line in an `.env` file must be in `VAR[=[VAL]]` format. The following synta - Blank lines are ignored. - Unquoted and double-quoted (`"`) values have [Interpolation](interpolation.md) applied. - Each line represents a key-value pair. Values can optionally be quoted. +- Delimiter separating key and value can be either `=` or `:`. +- Spaces before and after value are ignored. - `VAR=VAL` -> `VAL` - `VAR="VAL"` -> `VAL` - `VAR='VAL'` -> `VAL` + - `VAR: VAL` -> `VAL` + - `VAR = VAL ` -> `VAL` - Inline comments for unquoted values must be preceded with a space. - `VAR=VAL # comment` -> `VAL` - `VAR=VAL# not a comment` -> `VAL# not a comment` From 03b5474247086057be17bcdbf5cb6c8228098f31 Mon Sep 17 00:00:00 2001 From: Adam Monsen Date: Fri, 31 Oct 2025 08:50:16 -0700 Subject: [PATCH 2/2] linter: ignore intentional spaces in code --- .../how-tos/environment-variables/variable-interpolation.md | 2 +- content/reference/compose-file/services.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/manuals/compose/how-tos/environment-variables/variable-interpolation.md b/content/manuals/compose/how-tos/environment-variables/variable-interpolation.md index ae42fc1ae92e..516e2f27c03c 100644 --- a/content/manuals/compose/how-tos/environment-variables/variable-interpolation.md +++ b/content/manuals/compose/how-tos/environment-variables/variable-interpolation.md @@ -136,7 +136,7 @@ The following syntax rules apply to environment files: - `VAR="VAL"` -> `VAL` - `VAR='VAL'` -> `VAL` - `VAR: VAL` -> `VAL` - - `VAR = VAL ` -> `VAL` + - `VAR = VAL ` -> `VAL` - Inline comments for unquoted values must be preceded with a space. - `VAR=VAL # comment` -> `VAL` - `VAR=VAL# not a comment` -> `VAL# not a comment` diff --git a/content/reference/compose-file/services.md b/content/reference/compose-file/services.md index 12cf5703b5d4..2e2d319af883 100644 --- a/content/reference/compose-file/services.md +++ b/content/reference/compose-file/services.md @@ -694,7 +694,7 @@ Each line in an `.env` file must be in `VAR[=[VAL]]` format. The following synta - `VAR="VAL"` -> `VAL` - `VAR='VAL'` -> `VAL` - `VAR: VAL` -> `VAL` - - `VAR = VAL ` -> `VAL` + - `VAR = VAL ` -> `VAL` - Inline comments for unquoted values must be preceded with a space. - `VAR=VAL # comment` -> `VAL` - `VAR=VAL# not a comment` -> `VAL# not a comment`