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 option does not match docker-compose's behavior #847

Open thomas-huegel opened 5 months ago

thomas-huegel commented 5 months ago

Describe the bug docker-compose searches the env file relatively to the working directory. podman-compose searches the env file relatively to the directory containing the docker-compose.yml passed via the -f option.

To Reproduce docker-compose.yml:

version: "3"

services:
  example:
    image: busybox
    environment:
    - FOO=${FOO}
    command: >
      sh -c '
        set | grep FOO
      '

env-files/my-env:

FOO=foo

This works for docker-compose and not for podman-compose:

cd env-files
docker compose --env-file my-env -f ../docker-compose.yml up 
podman-compose --env-file my-env -f ../docker-compose.yml up 

This works for podman-compose and not for docker-compose:

cd env-files
docker compose --env-file env-files/my-env -f ../docker-compose.yml up 
podman-compose --env-file env-files/my-env -f ../docker-compose.yml up 

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

Environment:

Thanks!