Skip to content

Feature Request: Full Variable Interpolation Support in .env Files (Recursive and Default Values) #1384

@Lord-KalEl

Description

@Lord-KalEl

Is your feature request related to a problem? Please describe.
I'm always frustrated when I cannot use recursive variable substitution in .env files with podman compose. Unlike Docker Compose, podman compose does not support resolving variables defined in terms of other variables within the .env file. For example, defining A=Hello and B=${A} World results in B being interpreted literally as ${A} World instead of Hello World. This forces redundant definitions and violates the DRY principle, making environment configuration error-prone and harder to maintain.

Describe the solution you'd like
podman compose should fully support variable interpolation in .env files, including recursive and default-value syntax (e.g., ${VAR} and ${VAR:-default}), consistent with Docker Compose behavior. This would allow clean, modular configuration where variables can be defined once and reused, improving readability and reducing duplication.

Describe alternatives you've considered
Currently, I work around this by:

  • Using external tools like envsubst or custom shell scripts to pre-process .env files.
  • Duplicating values across the .env file, which increases maintenance effort and risk of inconsistency.
  • Explicitly using interpolation in the compose.yaml (e.g., ENV_VAR: ${ENV_VAR}), which forces changes in the compose file and reduces portability.

These workarounds are non-standard, add complexity, and break compatibility with Docker Compose workflows.

Additional context
This issue is well-documented in the community (e.g., Issue #718, Issue #1064) and represents a deviation from Docker Compose's expected behavior. Supporting full .env interpolation would improve compatibility, usability, and adherence to established container orchestration practices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions