containers / podman-compose

a script to run docker-compose.yml using podman
GNU General Public License v2.0
4.88k stars 470 forks source link

env_file: does not match docker-compose's behavior #848

Open thomas-huegel opened 5 months ago

thomas-huegel commented 5 months ago

Describe the bug docker-compose implicitely uses the .env file to populate variables contained in the file passed to env_file, whereas podman-compose does not.

To Reproduce .env:

BAR=bar

.foo:

FOO=$BAR

docker-compose.yml:

version: "3"

services:
  example:
    image: busybox
    env_file: .foo
    command: >
      sh -c '
        set | grep FOO
      '

Expected behavior I would expect podman-compose to behave the same way as docker-compose.

Actual behavior

docker compose up
example-1  | FOO='bar'

podman-compose up
[example] | FOO='$BAR'

Environment:

Thanks!

muayyad-alsadi commented 5 months ago
$ docker-compose --version
docker-compose version 1.27.4, build unknown
$ docker --version
Docker version 20.10.12, build e91ed57
$ docker-compose up
Creating envtest2_example_1 ... done
Attaching to envtest2_example_1
example_1  | FOO='$BAR'
envtest2_example_1 exited with code 0

it matches podman-compose

and this is well-documented

The value of VAL is used as is and not modified at all. For example if the value is surrounded by quotes (as is often the case of shell variables), the quotes are included in the value passed to Compose.

thomas-huegel commented 5 months ago

No, it does not, at least on my environment.

➜  docker-compose --version 
Docker Compose version 2.24.6
➜  docker --version
Docker version 25.0.2, build 29cf629222
➜  podman-compose --version 
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 4.9.3
podman-compose version 1.0.6
podman --version 
podman version 4.9.3
exit code: 0