containers / containers/podman-compose
Missing support for variable interpolation in .env files
- Dominant language
- Python
- Stars
- 6.2k
- Forks
- 622
- PR merge metrics
- No merged PRs in 30d
Description
podman-compose deviates from docker-compose in
- that it does not interpolate strings in .env files, and
- that it does not know about host env vars in .env (like $HOME, $PWD etc)
**To Reproduce**
**FILE: .env**
```env
A=bar
B=foo$A
C=$HOME/foo
D="${XDG_DATA_HOME:-$HOME/.local/share}/blabla"
```
**FILE: docker-compose.yml**
```yml
version: "4"
services:
variables:
image: busybox
command: ["/bin/busybox", "sh", "-c", "export | grep EXAMPLE"]
environment:
EXAMPLE_SIMPLE: "$B"
EXAMPLE_HOSTVAR_SIMPLE: $C
EXAMPLE_HOSTVAR_COMPLEX: $D
```
**Commands**
```sh
$ podman-compose config
```
**Expected behavior**
All the variables should be substituted as you would expect. Note that `docker-compose config` just works as expected.
Also no need to explicitly pass around variables with -e from when invoking docker-compose.
**Actual behavior**
Actual behaviour is that $B evaluates to literally foo$A, meaning it doesn't interpolate its value.
$C and $D results in errors, as podman-compose doesn't know about $HOME at all.
**Output**
```sh
$ podman-compose version
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.5.0
podman-compose version 1.0.6
podman --version
podman version 4.5.0
```
**Environment:**
Linux 6.1.31-2
**Additional context**
Current tests in repo do not test equality of output between docker-compose and podman-compose. That would possibly make your life easier to keep feature parity.
Contributor guide
Assessment
This issue has not been assessed yet.