Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman-compose 1.1.0 no longer loads env file in the same directory with compose.yaml when using -f #937

Open
Genzer opened this issue May 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Genzer
Copy link

Genzer commented May 13, 2024

Describe the bug

podman-compose 1.1.0 does not load env files (e.g .env) when running podman-compose command in a different working directory (from compose.yaml).

To Reproduce

Steps to reproduce the behavior:

The bug can be reproduced by the following set up:

# Create a directory containing compose.yaml and .env
mkdir project-demo

# Create the compose.yaml
cat <<'EOF' >project-demo/compose.yaml
# This file was copied from podman-compose/tests/env-file-tests
services:
  app:
    image: busybox
    command: ["/bin/busybox", "sh", "-c", "env | grep ZZ"]
    tmpfs:
      - /run
      - /tmp
    environment:
      ZZVAR1: $ZZVAR1
EOF

# Create the .env
cat <<'EOF' >project-demo/.env
ZZVAR1=podman-rocks-123
EOF

Run the following command:

podman-compose -f project-demo/compose.yaml config | grep ZZVAR1

Expected behavior

podman-compose loads the .env located in the same directory with compose.yaml.

$ podman-compose -f project-demo/compose.yaml config | grep ZZVAR1
podman-compose version: 1.0.6
['podman', '--version', '']
using podman version: 5.0.2
      ZZVAR1: podman-rocks-123

Actual behavior

No envfile is loaded even if env_file: './.env' is specified in the compose.yaml.

$ podman-compose -f project-demo/compose.yaml config | grep ZZVAR1
      ZZVAR1: ''

Output

$ podman-compose version
podman-compose version
podman-compose version 1.1.0
podman version 5.0.2

Environment:

  • OS: Linux and Mac
  • podman version: 5.0.2
  • podman compose version: 1.1.0 (2681566)

Additional context

I verified that this bug was not in 1.0.6. The behavior from 1.0.6 seemed consistent with docker compose.

The bug MAY come from 59a59c1#diff-afacb71932eed96cfb44057ef839da783c130d3a0062376a797a5f19f258292e.

@Genzer Genzer added the bug Something isn't working label May 13, 2024
@Genzer Genzer changed the title podman-compose 1.1.0 no longer loads env file in the same directory with compose.yaml podman-compose 1.1.0 no longer loads env file in the same directory with compose.yaml when using -f May 13, 2024
@jrunestone
Copy link

Can confirm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants