mirror of
https://github.com/containers/podman-compose.git
synced 2025-07-15 11:55:07 +02:00
`podman-compose` currently does not support interpolating environment variables in dictionary keys, despite the compose file specification indicating this capability. See the relevant compose-spec documentation: https://github.com/compose-spec/compose-spec/blob/main/12-interpolation.md This feature is useful in `labels` or `environment` sections, where keys can be user-defined strings. To enable interpolation, an alternate equal sign syntax must be used, e.g.: services: foo: labels: - "$VAR_NAME=label_value" After this PR `podman-compose` will align more closely with the compose file specification, allowing for the interpolation of environment variables in dictionary keys. Signed-off-by: Monika Kairaityte <monika@kibit.lt>
21 lines
773 B
YAML
21 lines
773 B
YAML
version: "3.7"
|
|
services:
|
|
variables:
|
|
image: busybox
|
|
command: ["/bin/busybox", "sh", "-c", "export | grep EXAMPLE"]
|
|
environment:
|
|
EXAMPLE_VARIABLE: "Host user: $EXAMPLE_VARIABLE_USER"
|
|
EXAMPLE_BRACES: "Host user: ${EXAMPLE_VARIABLE_USER}"
|
|
EXAMPLE_COLON_DASH_DEFAULT: ${NOT_A_VARIABLE:-My default}
|
|
EXAMPLE_DASH_DEFAULT: ${NOT_A_VARIABLE-My other default}
|
|
EXAMPLE_DOT_ENV: $DOT_ENV_VARIABLE
|
|
EXAMPLE_LITERAL: This is a $$literal
|
|
EXAMPLE_EMPTY: $NOT_A_VARIABLE
|
|
labels_test:
|
|
image: busybox
|
|
labels:
|
|
- "$TEST_LABELS=test_labels"
|
|
- test.${TEST_LABELS}=${TEST_LABELS}
|
|
- "${TEST_LABELS}.test2=test2(`${TEST_LABELS}`)"
|
|
|