containers / podman-compose

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

Align env_file support with docker compose (support path + required attributes) #897

Closed Jiehong closed 2 months ago

Jiehong commented 3 months ago

Describe the bug Today, if one wants to use multiple env files, only a list of string is supported, but the documentation of docker compose indicates that a complex object is supported. podman compose does not support this.

To Reproduce

The following docker-compose.yml does not work:

services:
  api:
    image: "something:latest"
    ports:
      - "8080:8080"
    env_file:
      - path: defaults.env
        required: true
      - path: override.env
        required: false

Expected behaviour

podman compose takes into account defaults.env and ensure it is present, and only loads override.env if present.

Source of docker-compose documentation: https://docs.docker.com/compose/environment-variables/set-environment-variables/#additional-information

Actual behaviour Running podman compose up api returns the following error:

>>>> Executing external compose provider "/usr/local/bin/docker-compose". Please refer to the documentation for details. <<<<

validating /Users/user/path/docker-compose.yaml: services.api.env_file.0 must be a string
Error: executing /usr/local/bin/docker-compose up --build api: exit status 15

Output

$ 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

Environment: