Skip to content

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

@Jiehong

Description

@Jiehong

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:

  • OS: Mac (untested elsewhere, but behaviour will likely be the same no matter the OS)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions