Skip to content

[BUG] Environment variables are not interpolated from .env file #144

@tonyo

Description

@tonyo

Describe the bug

Values inside the compose file are currently not interpolated from the (default) .env file.

How to reproduce

.env:

KEY1=value1
KEY2=value2

compose.yaml:

services:
  test:
    image: alpine:3.20
    command:
      - sh
      - -c
      - |
        echo ${KEY1}
        sleep 1d

Now when doing:

uc deploy -f compose.yaml  --yes --recreate

...it throws:

WARN[0000] The "KEY1" variable is not set. Defaulting to a blank string. 
Deployment plan:
...

And the container's output is empty (the command becomes just "echo ").

Expected behavior

Similar to docker compose behavior, uncloud should render the configuration with the interpolated variable from .env file:

There should be no warning, and the container's output should be "value1".

Environment:

  • Uncloud versions: latest master (dc56917)
  • OS version (uname -a): Linux XXX 6.8.0-79-generic #79-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 12 14:42:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Notes:

The behavior of interpolating environment variables should mirror the behavior of docker compose IMO

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions