Skip to content

[BUG] exec attempts to validate env_file for a different non-dependent service #13601

@ollie-bell

Description

@ollie-bell

Description

Given two services foo and bar where foo defines an env_file entry as a non-existent file. Running docker compose exec bar ... fails due to "env file not found".

This is inconsistent with e.g. docker compose up bar which runs successfully without attempting to validate the env_file of service foo

Steps To Reproduce

# compose.yaml
services:
  foo:
    image: hello-world
    env_file:
      - /does/not/exist/.env
  bar:
    image: hello-world

run:
docker compose exec bar bash

result:
env file /does/not/exist/.env not found: stat /does/not/exist/.env: no such file or directory

Compose Version

v5.0.2

Docker Environment


Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions